スペルの提案で「なし」が表示されます。
まず、settings.pyファイルに次のように設定します。
HAYSTACK_INCLUDE_SPELLING = True
インデックスを再構築しました:
python manage.py rebuild_index
良い測定のためにそれを更新しました
python manage.py update_index
検索は正しく機能します。「充電器」を検索すると、一致する結果が返されます。だから私のviews.pyで、私はそれから試しました:
from haystack.query import SearchQuerySet
def testpage(request):
test_results = SearchQuerySet().auto_query('Chargr')
spelling_suggestion = test_results.spelling_suggestion()
return render_to_response('testpage.html', {
'test': test_results,
'spelling_suggestion': spelling_suggestion
})
ただし、私のテンプレート:
<html>
<body>
{{ test }}<p>
{{ spelling_suggestion }}
</body>
</html>
それでも何も返されません:
[]
None
明らかに、{{test}}には何も期待していませんでしたが、{{spelling_suggestion}}に何かを取得するべきではありませんか?私は何が欠けていますか?