【问题标题】:How do I get the tf and idf score from a Solr query?如何从 Solr 查询中获取 tf 和 idf 分数?
【发布时间】:2017-09-27 06:30:17
【问题描述】:

按照 Solr 文档(https://cwiki.apache.org/confluence/display/solr/Function+Queries 和其他人),我应该像使用 termfreq(fieldname, 'term') 一样将 idf(fieldname, 'term') 放在字段列表中。但是,每当我尝试这个时,我都会得到一个例外:

org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request

通过查看我可以找到的日志:

null:java.lang.UnsupportedOperationException: requires a TFIDFSimilarity (such as ClassicSimilarity)

我不知道那些是什么。此外,当我使用 debugQuery=on 时,它会向我显示文档的 idf 值以及许多其他内容:

4.406719 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5))

我应该怎么做才能修复这些错误或获得一个术语所需的 tf 和 idf 值?

【问题讨论】:

    标签: java apache search solr lucene


    【解决方案1】:

    您需要在“托管架构”中添加以下行,其中在架构末尾注释相似性标签

    <similarity class="solr.ClassicSimilarityFactory"/>
    

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,发现了这个 chrome 扩展 -

      https://chrome.google.com/webstore/detail/solr-query-debugger/gmpkeiamnmccifccnbfljffkcnacmmdl?hl=en

      它对分解“解释”非常有帮助,并且会为你显示 idf 的值。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-11-22
        • 2016-09-03
        • 2015-03-31
        • 2019-04-17
        • 1970-01-01
        • 2013-03-01
        • 2018-03-23
        • 2016-08-07
        相关资源
        最近更新 更多