我正在使用 django haystack(带有 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
haystack'sSearchQuerySet().autocomplete(content=above query)
不会产生上述结果。
如何构建这样的查询集?
我们还在 stackoverflow 的提问页面中看到了它;即,当我们在标题字段中键入时,它会为我们提供可能已经有您答案的问题列表。