def search(self):
        if not self.is_valid():
            #return self.no_query_found()
            return {'authority' : self.no_query_found(),
                    'citation': self.no_query_found()}

        if not self.cleaned_data.get('q'):
            #return self.no_query_found()
            return {'authority' : self.no_query_found(),
                    'citation': self.no_query_found()}

        query_tuple = self.has_specified_field(self.cleaned_data['q'])

        # Removed: query sanitization already occurs (by design) in the
        #  (haystack) Query used by the SearchEngine. We're clobbering wildcards
        #  here.  We can add it back if there is a security issue, but it seems
        #  like this should all happen in the search backend.   -EP
        #
        # if query_tuple[1] == 'content':
        #     qstring = helper_methods.normalize(qstring)

        sqs = self.searchqueryset.auto_query(*query_tuple)

        sqs_citation = sqs.load_all()
        sqs_authority = sqs_citation

        # We apply faceting ourselves.
        for facet in self.selected_facets:
            if ":" not in facet:
                continue

            field, value = facet.split(":", 1)
            field = field.strip()
            value = value.strip()

            if value and field.startswith('citation_'):
                sqs_citation = sqs_citation.narrow(u'%s:"%s"' % (field[9:], sqs.query.clean(value)))
            if value and field.startswith('authority_'):
                sqs_authority = sqs_authority.narrow(u'%s:"%s"' % (field[10:], sqs.query.clean(value)))

        sort_order_citation = self.get_sort_order_citation()
        sort_order_authority = self.get_sort_order_authority()
        sort_order_dir_citation = self.get_sort_order_direction_citation()
        sort_order_dir_authority = self.get_sort_order_direction_authority()

        if sort_order_dir_citation == 'descend':
            sort_order_citation = "-" + sort_order_citation
        if sort_order_dir_authority == 'descend':
            sort_order_authority = "-" + sort_order_authority

        results_authority = sqs_authority.models(*self.get_authority_model()).filter(public=True).order_by(sort_order_authority)
        results_citation = sqs_citation.models(*self.get_citation_model()).filter(public=True).order_by(sort_order_citation)

        return {'authority' : results_authority,
                'citation': results_citation}
dataset/ETHPy150Open upconsulting/IsisCB/isiscb/isisdata/forms.py/MyFacetedSearchForm.search/original