Elasticsearch成绩禁用IDF [英] Elasticsearch score disable IDF

查看:391
本文介绍了Elasticsearch成绩禁用IDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ES来使用模糊搜索技术搜索大量的人名。

I'm using ES for searching a huge list of human names employing fuzzy search techniques.

TF适用于评分,但我实际上不需要IDF在这种情况下。这确实是在稀释分数。我仍然希望将TF和Field Norm应用于得分。

TF is applicable for scoring, but IDF is really not required for me in this case. This is really diluting the score. I still want TF and Field Norm to be applied to the score.

如何为查询禁用/抑制IDF,但保留TF和Field Norm?

How do I disable/suppress IDF for my queries, but keep TF and Field Norm?

我遇到了禁用IDF计算线程,但是它没有帮助我。在这种情况下,恒定分数查询似乎对我也没有帮助。

I came across the Disable IDF calculation thread, but it did not help me. It also seems like the constant score query would not help me in this case.

推荐答案

创建时索引,我们可以将自己的相似度计算方法放入设置部分,如果您只需要禁用IDF并将其他设置用作默认设置,则可以编写一个简单的脚本,例如:

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:

"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;"`}

此处

这篇关于Elasticsearch成绩禁用IDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆