5👍
✅
The way django-haystack works, the data inside the document=True
field is used for a general search, and any other fields are used for individual filtering. So in your case, a search will only use the name
field. To fix this, you’ll need to use a template that specifies all the fields to be used in a search. First of all, use:
text = indexes.EdgeNgramField(document=True, use_template=True)
Then you’ll need to create a new template inside your template directory called search/indexes/myapp/myuser_text.txt
and place the following inside:
{{ object.username }}
{{ object.name }}
See http://django-haystack.readthedocs.org/en/latest/tutorial.html#handling-data for full reference
Source:stackexchange.com