Controlling Solr score/sort
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
精彩评论