文本匹配不如预期,怎么回事呀

2021-05-11 15:03:36 +08:00
 longkas239

用 match query 查询字符串"the lord",结果返回

score=8.081023 "The Second Sun" score=5.412263 "Lord of War" score=4.5157876 "The Lord of the Rings: The Two Towers" score=4.120181 "The Lord of the Rings: The Fellowship of the Ring" score=4.120181 "The Lord of the Rings: The Return of the King"

模糊参数改一下,结果也是一样的。刚接触 Elasticsearch,这排序是正常的吗, "The Second Sun" 评分怎么那么高

1479 次点击
所在节点    Elasticsearch
4 条回复
littlehappi
2021-05-11 16:05:57 +08:00
用 match_phrase 试试
skyleft
2021-05-12 10:12:57 +08:00
按你这个搜出来的应该是这样吧

"hits" : [
{
"_index" : "test",
"_type" : "1",
"_id" : "6NVkW3kBGtH1h4VDFSRZ",
"_score" : 0.86009264,
"_source" : {
"title" : "The Lord of the Rings: The Two Towers"
}
},
{
"_index" : "test",
"_type" : "1",
"_id" : "6dVkW3kBGtH1h4VDVCSG",
"_score" : 0.8239962,
"_source" : {
"title" : "The Lord of the Rings: The Fellowship of the Ring"
}
},
{
"_index" : "test",
"_type" : "1",
"_id" : "59VjW3kBGtH1h4VD1iSf",
"_score" : 0.65877354,
"_source" : {
"title" : "Lord of War"
}
},
{
"_index" : "test",
"_type" : "1",
"_id" : "5NViW3kBGtH1h4VD3SQA",
"_score" : 0.35161144,
"_source" : {
"title" : "The Second Sun"
}
}
longkas239
2021-05-12 19:56:06 +08:00
@skyleft 你用的是 match_phrase 类型吗
skyleft
2021-05-13 06:43:21 +08:00
@longkas239 match

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/776241

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX