Say I have a model Person
for which there is a PersonIndex
class in search_indexes.py
that makes all fields of it searchable. How can I make a search within only those entries where say the has_title
field is True
?
I tried the following, but it just searches among all entries, not just the ones where has_title
is True
:
srch = request.GET.get('search', "")
sqs = SearchQuerySet().filter(has_title=True)
clean_query = sqs.query.clean(srch)
results = sqs.raw_search(clean_query)
I am using Whoosh 2.4.1
, Django-haystack 1.2.7
and Django 1.4
.