SolR : More Like This on number fields

那年仲夏 提交于 2019-12-12 15:12:21

问题


I wonder if it is possible to configure mlt (more like this) to do the similarity on close numbers ?

For example, a document with the field numberOfParticipant at 10, i would like to have some similar documents with numberOfParticipant between 5 and 15.

Does this option exist ?


回答1:


FunctionQuery may be your solution http://wiki.apache.org/solr/FunctionQuery . I never used it myself, but this must be reasonably easy to code something like this:

10-|10-X| where |x| is the absolute value of x 

Sample values of X and output:
X  => Result
8     8
9     9
10    10
11    9
12    8

Then specify a boost for that function. In solr, you may need to code it like sub(10,abs(sub(10,X))).


But then if you actually wanted to categorize results as "less than 5", "5-15", "greater than 15", choose faceting http://wiki.apache.org/solr/SolrFacetingOverview



来源:https://stackoverflow.com/questions/7243109/solr-more-like-this-on-number-fields

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!