elasticsearch 当第一个字母拼写错误时,elasticsearch短语提示器产生意外结果
我正在使用Elasticsearch短语建议器来纠正用户的拼写错误。除非用户输入一个第一个字母拼写错误的查询,否则一切都正常工作。在这种情况下,短语suggester不返回任何内容或返回意外结果 我的文档和查询与以下示例完全相同: 第四个字母拼写错误的示例:
elasticsearch 当第一个字母拼写错误时,elasticsearch短语提示器产生意外结果,
elasticsearch,lucene,
elasticsearch,Lucene,我正在使用Elasticsearch短语建议器来纠正用户的拼写错误。除非用户输入一个第一个字母拼写错误的查询,否则一切都正常工作。在这种情况下,短语suggester不返回任何内容或返回意外结果 我的文档和查询与以下示例完全相同: 第四个字母拼写错误的示例: { "_shards": ... "hits": ... "timed_out": false, "took": 3, "suggest": { "simple_phrase" : [ {
{
"_shards": ...
"hits": ...
"timed_out": false,
"took": 3,
"suggest": {
"simple_phrase" : [
{
"text" : "mobel prize",
"offset" : 0,
"length" : 11,
"options" : []
}
]
}
}
{
"_shards": ...
"hits": ...
"timed_out": false,
"took": 3,
"suggest": {
"simple_phrase" : [
{
"text" : "noble prize",
"offset" : 0,
"length" : 11,
"options" : [ {
"text" : "nobel prize",
"highlighted": "<em>nobel</em> prize",
"score" : 0.5962314
}]
}
]
}
}
{
“_碎片”:。。。
“热门歌曲”:。。。
“超时”:false,
"take":3,,
“建议”:{
“简单短语”:[
{
“正文”:“诺贝尔奖”,
“偏移量”:0,
“长度”:11,
“期权”:[{
“文本”:“诺贝尔奖”,
“突出显示”:“诺贝尔奖”,
“分数”:0.5962314
}]
}
]
}
}
更改生成器的前缀长度
前缀长度
必须匹配的最小前缀字符数才能成为候选字符。默认值为1。增加这个数字可以提高拼写检查性能。通常在学期开始时不会出现拼写错误。(旧名称“prefix_len”已弃用)
警告:通常将模糊匹配查询的前缀长度设置为零会对性能产生非常严重的负面影响
{
"_shards": ...
"hits": ...
"timed_out": false,
"took": 3,
"suggest": {
"simple_phrase" : [
{
"text" : "noble prize",
"offset" : 0,
"length" : 11,
"options" : [ {
"text" : "nobel prize",
"highlighted": "<em>nobel</em> prize",
"score" : 0.5962314
}]
}
]
}
}