def get_queryset(self):
        """
        Overridde the get_queryset method to
        do some validations and build the search queryset.
        """
        entries = Entry.published.none()

        if self.request.GET:
            self.pattern = self.request.GET.get('pattern', '')
            if len(self.pattern) < 3:
                self.error = _('The pattern is too short')
            else:
                entries = Entry.published.search(self.pattern)
        else:
            self.error = _('No pattern to search found')
        return entries
dataset/ETHPy150Open Fantomas42/django-blog-zinnia/zinnia/views/search.py/BaseEntrySearch.get_queryset/original