【问题标题】:Is there a way to score fuzzy hits with the same score as exact hits?有没有办法以与精确命中相同的分数对模糊命中进行评分?
【发布时间】:2015-02-07 04:48:35
【问题描述】:

我正在尝试将 elasticsearch 用作可以匹配来自不同来源的记录的集成工具。我正在为此组合过滤器和查询。过滤器正在过滤掉不相关的记录并放置低谷候选匹配。然后在这些候选人中都被评分。我正在使用模糊匹配,因为某些记录可能包含拼写错误(Nicolson Way/Nicholson Way)。无论是模糊匹配还是相等匹配,我都希望它们得到同等评分。

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/fuzzy-scoring.html

有没有办法通过 Elasticsearch 实现这一目标?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    使用constant_score 给它一个您选择的分数:

    {
      "query": {
        "constant_score": {
          "filter": {
            "query": {
              "fuzzy": {"text": "whatever"}
            }
          },
          "boost": 1
        }
      }
    }
    

    【讨论】:

    • 这个场景怎么样:文本可能有多个单词,如果找到更多单词,我想获得更高的分数。但我不想超过 5 分。程序将是 ((wordsFound/totalWordsInQuery)*maxFixedScore)。您的解决方案将导致部分匹配与完全匹配具有相同的分数。
    猜你喜欢
    • 2016-02-23
    • 1970-01-01
    • 2023-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-14
    • 2021-05-16
    相关资源
    最近更新 更多