【发布时间】:2018-11-30 11:23:44
【问题描述】:
我正在使用 Elasticsearch Phrase Suggester 来纠正用户的拼写错误。除非用户输入第一个字母拼写错误的查询,否则一切都按我的预期工作。在这种情况下,短语建议器不返回任何内容或返回意外结果。
我的建议查询:
{
"suggest": {
"text": "user_query",
"simple_phrase": {
"phrase": {
"field": "title.phrase",,
"collate": {
"query": {
"inlile" : {
"bool": {
"should": [
{ "match": {"title": "{{suggestion}}"}},
{ "match": {"participants": "{{suggestion}}"}}
]
}
}
}
}
}
}
} }
首字母拼写错误示例:
"simple_phrase" : [
{
"text" : "گاشانچی",
"offset" : 0,
"length" : 11,
"options" : [ {
"text" : "گارانتی",
"score" : 0.00253151
}]
}
]
第五个字母拼写错误的例子:
"simple_phrase" : [
{
"text" : "کاشاوچی",
"offset" : 0,
"length" : 11,
"options" : [ {
"text" : "کاشانچی",
"score" : 0.1121
},
{
"text" : "کاشانجی",
"score" : 0.0021
},
{
"text" : "کاشنچی",
"score" : 0.0020
}]
}
]
我希望这两个拼写错误的查询有相同的建议(我的预期建议是第二个)。怎么了?
P.S:我正在将此功能用于波斯语。
【问题讨论】:
-
请参考我在这篇帖子上的回答stackoverflow.com/questions/59527443/…
标签: elasticsearch solr lucene information-retrieval