MCPcopy Index your code
hub / github.com/django-haystack/django-haystack / search

Method search

haystack/forms.py:79–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

77 super().__init__(*args, **kwargs)
78
79 def search(self):
80 sqs = super().search()
81
82 # We need to process each facet to ensure that the field name and the
83 # value are quoted correctly and separately:
84 for facet in self.selected_facets:
85 if ":" not in facet:
86 continue
87
88 field, value = facet.split(":", 1)
89
90 if value:
91 sqs = sqs.narrow('%s:"%s"' % (field, sqs.query.clean(value)))
92
93 return sqs
94
95
96class ModelSearchForm(SearchForm):

Callers 1

test_searchMethod · 0.95

Calls 3

searchMethod · 0.45
narrowMethod · 0.45
cleanMethod · 0.45

Tested by 1

test_searchMethod · 0.76