lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Limit Results By Score?
Date Tue, 05 May 2015 16:18:22 GMT

: We have implemented a custom scoring function and also need to limit the
: results by score.  How could we go about that?  Alternatively, can we
: suppress the results early using some kind of custom filter?

in general, limiting by score is a bad idea for all of the reasons 
outlined here...

...if you have defined a custom scoring function, then many of those 
issues may not apply, and you can use the frange parser to filter 
documents which do not have a "score" in a given range...

How exactly you use frange with your "custom score" depends on how you 
implement it -- if ou implemented it directly as a ValueSource (w/ a 
ValueSourceParser) then you can just call that function directly.

If you've implemented it as a custom similarity on regular query 
structures, you can still use frange and just wrap your query using the 
"query()" function.

Eithe way, you can use the frange parser as part of a filter query to 
limit the results based on the score of your function -- independent of 
what your main query / sort are.

if, in the later case, you want to match & sort documents based on the 
same query, you can still do that using local params to refer to the query 
in both places...

q=your_custom_query&sort=score desc&fq={!frange l=90}query($q)


View raw message