我有两个问题,建立草堆/ Django的/ elasticsearch草堆Django的Elasticsearch拼写
我从来没有从索引字段,如结果indexes.CharField(model_attr ='title')没有得到我的结果。只有当我将{{object.title}}放入我的txt模板中时,才会得到匹配标题的结果
如果我的标题是'foo',我从来没有得到'fo'的结果,而我确实设置了INCLUDE_SPELLING设置在我的后端设置为True。
该文档没有说明关于这些情况的任何特殊情况,我的设置是根据干草堆文档,我错过了什么?
我的指数:
class FooIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
title = indexes.CharField(model_attr='title') # never gets me results unless I add it to the template
def get_model(self):
return Foo
我的设置:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
'INCLUDE_SPELLING': True,
},
}