You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Johannes Ruscheinski <jo...@uni-tuebingen.de> on 2015/05/05 11:39:12 UTC

Limit Results By Score?

Hi,

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?

--Johannes

-- 
Dr. Johannes Ruscheinski
Universitätsbibliothek Tübingen - IT-Abteilung -
Wilhelmstr. 32, 72074 Tübingen

Tel: +49 7071 29-72820
FAX: +49 7071 29-5069
Email: johannes.ruscheinski@uni-tuebingen.de



Re: Limit Results By Score?

Posted by Chris Hostetter <ho...@fucit.org>.
: 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/