lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
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...

https://wiki.apache.org/lucene-java/ScoresAsPercentages

...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...

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-FunctionRangeQueryParser

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)


-Hoss
http://www.lucidworks.com/

Mime
View raw message