I'm trying to implement yielding results for a searching only a part of a word (which is called autocomplete
according to the Haystack docs if I'm not mistaken).
Example:
Search "gol"
Result "goldfish"
What have I tried?
I did as asked in step 1 of the docs, I added the following line in my Index class:
content_auto = indexes.EdgeNgramField(model_attr='content')
Then did python manage.py rebuild_index
.
Rebuilding the index however produced an error haystack.exceptions.SearchFieldError: The model '<Person: Reginald>' does not have a model_attr 'content'.
With Reginald
being the first entry in my indexed table and Person
being the model I indexed.
Now indeed my model doesn't have a field called content
but as it is shown in the docs it should not need to have such a field.
I am using Whoosh 2.4.1
, Django-haystack 1.2.7
and Django 1.4
.