[solr] solr Similarity:切换不同相似度计算方法

2020-10-29 10:21:37 浏览数 (1)

Similarity改变solr的打分机制;

solr本身已经提供了几种算法

代码语言:javascript复制
org.apache.solr.search.similarities.BM25SimilarityFactory
org.apache.solr.search.similarities.DefaultSimilarityFactory
org.apache.solr.search.similarities.DFRSimilarityFactory
org.apache.solr.search.similarities.IBSimilarityFactory
org.apache.solr.search.similarities.LMDirichletSimilarityFactory
org.apache.solr.search.similarities.LMJelinekMercerSimilarityFactory
org.apache.solr.search.similarities.SchemaSimilarityFactory

可以在managed-schema下面添加:

<similarity class="org.apache.solr.search.similarities.SchemaSimilarityFactory"/>

<similarity class="org.apache.solr.search.similarities.BM25SimilarityFactory"/>

<similarity class="org.apache.solr.search.similarities.DefaultSimilarityFactory"/>

.....

测试会发现不同相似度计算方法检索上的差异:

0 人点赞