开发者

SolR : More Like This on number fields

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 numberOfPartici开发者_JAVA百科pant between 5 and 15.

Does this option exist ?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜