views:

232

answers:

1

Hey,

I'm trying django-haystack with Solr and HAYSTACK_INCLUDE_SPELLING = True.

How do you access the spelling suggestions on the template (generated by the default SearchView) ?

Edit: another question: Can the Spelling Suggestion find words from the database ? For example, using the default Note model from the haystack doc, and the default SearchView, there is no spelling suggestions when I search the word "Lorm" when the database contains a note called "Lorem ipsum". Is it normal ?

Thanks :-)

+1  A: 

If you have the search query set in the template, you can do:

{{ sqs.spelling_suggestion }}

Look at: http://docs.haystacksearch.org/dev/searchqueryset_api.html#spelling-suggestion

for more details.

For haystack to find the spelling suggestions, the search template should include the field you are looking for. So if you search template includes {{ object.title }} you should be picking up the spelling suggestion.

Maybe you forgot to do

python manage.py update_index

after you added the lorem note.

Hassan
I forgot to update the indexes. It's now working, thank you. :-)