0
我正在使用django干草堆(使用ElasticSearch搜索引擎),并希望实现与自动完成不同的自动建议功能。实现自动建议功能(不自动完成)
例如,考虑到已经索引的小数据集(表行):
When your code is all set
And you have finished it all
Your goals have been met
And you feel not so small
这是我希望实现:
First input query(for search index): 'finished coding'
expected search result:
When your code is all set
And you have finished it all
Second, input query(for search index): 'finished coding! goals met!'
expected search result:
When your code is all set
And you have finished it all
Your goals have been met
草垛的SearchQuerySet().autocomplete(content=above query)
不会产生上述结果。
如何建立这样的查询集?
我们也看到它在stackoverflow的问题页面;即当我们输入标题字段时,它会给我们一个问题列表,这些问题可能已经有你的答案。
'haystack's SearchQuerySet()。autocomplete(content = above query)does not produce the above result.'它是什么_does_产生的? – 2013-02-15 18:35:20
@Hedde:它只是按顺序匹配确切的短语;否则返回空结果! – anand 2013-02-15 18:55:44
您是否将haystack的[默认操作符](http://django-haystack.readthedocs.org/en/v1.2.4/settings.html#haystack-default-operator)设置为'OR',它默认为'AND'。 。 – 2013-02-15 19:14:42