问题描述
遵循Solr文档( https://cwiki.apache.org/confluence /display/solr/Function + Queries 和其他),我应该像对termfreq(fieldname,'term')一样,将idf(fieldname,'term')放在字段列表中.但是,每当我尝试这样做时,我都会得到一个例外:
Following Solr documentations (https://cwiki.apache.org/confluence/display/solr/Function+Queries and others) I should just put idf(fieldname, 'term') as I do with termfreq(fieldname, 'term') in the field list. However, whenever I try this I get an exception as:
org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request
通过查看日志,我可以找到:
By looking at the logs I could find:
null:java.lang.UnsupportedOperationException: requires a TFIDFSimilarity (such as ClassicSimilarity)
我不知道那是什么.同样,当我使用 debugQuery = on 时,它向我展示了文档的idf值以及许多其他内容:
And I have no idea what those are. Also when I use debugQuery=on it shows me, along with a lot of other things, the idf value for the document as:
4.406719 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5))
我应该怎么做才能解决这些错误或获得期望的tf和idf值?
What should I do to fix these errors or to get desired tf and idf value for a term?
推荐答案
您需要在托管模式"中添加以下行,在模式末尾标注相似性标记
You need to add following line in your "managed-schema" where similarity tag is commented at the end of the schema
<similarity class="solr.ClassicSimilarityFactory"/>
这篇关于如何从Solr查询中获得tf和idf分数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!