我有一个文档,其中包含许多字段,其中之一是country
。许多文档具有相同的country
。
例如,当我针对match query
进行fuzzy
或country
搜索并查询Belgium
时,它将返回与Belgium
国家/地区匹配的文档列表,但它们的得分均不同。我相信是由于tdidf的相似性以及其他文档 Realm 中belgium
术语的存在等。
在这种情况下,我希望它返回相同的分数。我应该使用什么相似性?
更新
我有接下来的6个文件:
{country:"Austria", title: "house"}
{country:"Austria", title: "Austria village"}
{country: "Germany", title: "deutch hotel" }
{country:"Austria", title: ""}
{country: "USA", title: "Usa hotel" }
{country: "USA", title: "Usa another hotel" }
当我针对国家/地区执行匹配查询时:
{
query: {match: {country: "Austria"}}
}
我回顾下一个结果:
[ {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "1",
"_score" : 1.0, "_source" : {country:"Austria", title: "Austria village"}
}, {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "2",
"_score" : 0.30685282, "_source" : {country:"Austria", title: "house"}
}, {
"_index" : "elasticdemo_docs",
"_type" : "doc",
"_id" : "3",
"_score" : 0.30685282, "_source" : {country:"Austria", title: ""}
} ]
我希望所有3个文档都收到相同的
_score
,因为它们作为国家/地区都具有Austria
。我应该使用什么相似性?
最佳答案
似乎我发现了问题-它与以下内容有关:
http://www.elasticsearch.org/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch/
使用dfs_query_then_fetch
搜索类型后,我得到了预期的结果。
关于solr - Elasticsearch-国家相似度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22016735/