开发者

Controlling Solr score/sort

开发者 https://www.devze.com 2023-01-03 11:45 出处:网络
I want to 开发者_StackOverflowfilter a property within a range, but items that does not have the property should come last in the result. My solution was to set it to -1 if the property was not set.

I want to 开发者_StackOverflowfilter a property within a range, but items that does not have the property should come last in the result. My solution was to set it to -1 if the property was not set.

+(property:[10000000001 TO 10000000019] property:"-1"^0.5)

This doesn't work, since every document with property:-1 get a very high score, for some reason. Is there a way to reliably control the sorting here?

Boosting the range instead would mean I must boost every other term, which I'd rather not do.


The property with value -1 is boosted, so removing it would give you better results.

Furthermore if a property is missing, just keep it missing. Don't set it to -1.

You can sort the result with sort=property desc in the query or sort the property while indexing with sortMissingLast=true

0

精彩评论

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