简体   繁体   English

Elasticsearch评分禁用IDF

[英]Elasticsearch score disable IDF

I'm using ES for searching a huge list of human names employing fuzzy search techniques. 我正在使用ES搜索使用模糊搜索技术的大量人名。

TF is applicable for scoring, but IDF is really not required for me in this case. TF适用于评分,但在这种情况下我并不需要IDF。 This is really diluting the score. 这真的是在稀释分数。 I still want TF and Field Norm to be applied to the score. 我仍然希望将TF和Field Norm应用于分数。

How do I disable/suppress IDF for my queries, but keep TF and Field Norm? 如何为我的查询禁用/抑制IDF,但保留TF和Field Norm?

I came across the Disable IDF calculation thread, but it did not help me. 我遇到了禁用IDF计算线程,但它没有帮助我。 It also seems like the constant score query would not help me in this case. 在这种情况下,似乎常数分数查询也无法帮助我。

When create index, we can put our own similarity calculate method into the setting parts, if you need only disable IDF and use others as the default setting, you can write just a simple script such as: 当创建索引时,我们可以将自己的相似度计算方法放入设置部分,如果只需要禁用IDF并使用其他设置作为默认设置,则只需编写一个简单的脚本,例如:

"script": {"source": "double tf = Math.sqrt(doc.freq); double idf = 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;"`}

This is shown here . 在这里显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM