【发布时间】:2021-01-24 14:40:47
【问题描述】:
我正在使用 django_elasticsearch_dsl。
我的文档:
html_strip = analyzer(
'html_strip',
tokenizer='standard',
filter=["lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
class Document(django_elasticsearch_dsl.Document):
name = TextField(
analyzer=html_strip,
fields={
'raw': fields.KeywordField(),
'suggest': fields.CompletionField(),
}
)
...
我的要求:
_search = Document.search().suggest("suggestions", text=query, completion={'field': 'name.suggest'}).execute()
我已将以下文档“名称”编入索引:
"This is a test"
"this is my test"
"this test"
"Test this"
现在如果搜索This is my text if 将只收到
"this is my text"
但是,如果我搜索 test,那么我得到的只是
"Test this"
即使我想要所有名称中包含 test 的文档。
我错过了什么?
【问题讨论】:
-
您有机会浏览我的回答吗,期待您的反馈????
标签: python django elasticsearch elasticsearch-dsl