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 Robert Brown <ro...@intelcompute.com> on 2011/10/27 13:30:31 UTC
Limit by score? sort by other field
When we display search results to our users we include a percentage
score.
Top result being 100%, then all others normalised based on the
maxScore, calculated outside of Solr.
We now want to limit returned docs with a percentage score higher than
say, 50%.
e.g. We want to search but only return docs scoring above 80%, but
want to sort by date, hence not being able to just sort by score.
Re: Limit by score? sort by other field
Posted by Chris Hostetter <ho...@fucit.org>.
: Sounds like a custom sorting collector would work - one that throws away
: docs with less than some minimum score, so that it only collects/sorts
did you look at the example query Karsten mentioned (and also discussedin
the linked thread)
there is no need for a custom collector to do this, you just need to
specify the range of score values you want to constrain the results to
(but if you wnat it based on a percentage, you have to first do a request
to compute the real values to use on your ranges relative the max
score)...
: > So will
: > sort=date+desc&q={!frange l=0.85}query($qq)
: > qq=<the original relevancy query>
: > help?
All of this requires you to bear in mind a *HUGE* freaking caveat about
filtering by score and scores as percentages...
https://wiki.apache.org/lucene-java/LuceneFAQ#Can_I_filter_by_score.3F
https://wiki.apache.org/lucene-java/ScoresAsPercentages
-Hoss
Re: Limit by score? sort by other field
Posted by Robert Stewart <bs...@gmail.com>.
Sounds like a custom sorting collector would work - one that throws away docs with less than some minimum score, so that it only collects/sorts documents with some minimum score. AFAIK score is calculated even if you sort by some other field.
On Oct 27, 2011, at 9:49 AM, karsten-solr@gmx.de wrote:
> Hi Robert,
>
> take a look to
> http://lucene.472066.n3.nabble.com/How-to-cut-off-hits-with-score-below-threshold-td3219064.html#a3219117
> and
> http://lucene.472066.n3.nabble.com/Filter-by-relevance-td1837486.html
>
> So will
> sort=date+desc&q={!frange l=0.85}query($qq)
> qq=<the original relevancy query>
> help?
>
>
> Best regards
> Karsten
>
> -------- Original-Nachricht --------
>> Datum: Thu, 27 Oct 2011 12:30:31 +0100
>> Von: Robert Brown <ro...@intelcompute.com>
>> An: solr-user@lucene.apache.org
>> Betreff: Limit by score? sort by other field
>
>> When we display search results to our users we include a percentage
>> score.
>>
>> Top result being 100%, then all others normalised based on the
>> maxScore, calculated outside of Solr.
>>
>> We now want to limit returned docs with a percentage score higher than
>> say, 50%.
>>
>> e.g. We want to search but only return docs scoring above 80%, but
>> want to sort by date, hence not being able to just sort by score.
>>
Re: Limit by score? sort by other field
Posted by Jason Toy <ja...@gmail.com>.
I have a similar problem except I need to filter scores that are too high.
Robert Stewart <bs...@gmail.com> 於 Oct 27, 2011 7:04 AM 寫道:
> BTW, this would be good standard feature for SOLR, as I've run into this requirement more than once.
>
>
> On Oct 27, 2011, at 9:49 AM, karsten-solr@gmx.de wrote:
>
>> Hi Robert,
>>
>> take a look to
>> http://lucene.472066.n3.nabble.com/How-to-cut-off-hits-with-score-below-threshold-td3219064.html#a3219117
>> and
>> http://lucene.472066.n3.nabble.com/Filter-by-relevance-td1837486.html
>>
>> So will
>> sort=date+desc&q={!frange l=0.85}query($qq)
>> qq=<the original relevancy query>
>> help?
>>
>>
>> Best regards
>> Karsten
>>
>> -------- Original-Nachricht --------
>>> Datum: Thu, 27 Oct 2011 12:30:31 +0100
>>> Von: Robert Brown <ro...@intelcompute.com>
>>> An: solr-user@lucene.apache.org
>>> Betreff: Limit by score? sort by other field
>>
>>> When we display search results to our users we include a percentage
>>> score.
>>>
>>> Top result being 100%, then all others normalised based on the
>>> maxScore, calculated outside of Solr.
>>>
>>> We now want to limit returned docs with a percentage score higher than
>>> say, 50%.
>>>
>>> e.g. We want to search but only return docs scoring above 80%, but
>>> want to sort by date, hence not being able to just sort by score.
>>>
>
Re: Limit by score? sort by other field
Posted by Robert Stewart <bs...@gmail.com>.
BTW, this would be good standard feature for SOLR, as I've run into this requirement more than once.
On Oct 27, 2011, at 9:49 AM, karsten-solr@gmx.de wrote:
> Hi Robert,
>
> take a look to
> http://lucene.472066.n3.nabble.com/How-to-cut-off-hits-with-score-below-threshold-td3219064.html#a3219117
> and
> http://lucene.472066.n3.nabble.com/Filter-by-relevance-td1837486.html
>
> So will
> sort=date+desc&q={!frange l=0.85}query($qq)
> qq=<the original relevancy query>
> help?
>
>
> Best regards
> Karsten
>
> -------- Original-Nachricht --------
>> Datum: Thu, 27 Oct 2011 12:30:31 +0100
>> Von: Robert Brown <ro...@intelcompute.com>
>> An: solr-user@lucene.apache.org
>> Betreff: Limit by score? sort by other field
>
>> When we display search results to our users we include a percentage
>> score.
>>
>> Top result being 100%, then all others normalised based on the
>> maxScore, calculated outside of Solr.
>>
>> We now want to limit returned docs with a percentage score higher than
>> say, 50%.
>>
>> e.g. We want to search but only return docs scoring above 80%, but
>> want to sort by date, hence not being able to just sort by score.
>>
Re: Limit by score? sort by other field
Posted by ka...@gmx.de.
Hi Robert,
take a look to
http://lucene.472066.n3.nabble.com/How-to-cut-off-hits-with-score-below-threshold-td3219064.html#a3219117
and
http://lucene.472066.n3.nabble.com/Filter-by-relevance-td1837486.html
So will
sort=date+desc&q={!frange l=0.85}query($qq)
qq=<the original relevancy query>
help?
Best regards
Karsten
-------- Original-Nachricht --------
> Datum: Thu, 27 Oct 2011 12:30:31 +0100
> Von: Robert Brown <ro...@intelcompute.com>
> An: solr-user@lucene.apache.org
> Betreff: Limit by score? sort by other field
> When we display search results to our users we include a percentage
> score.
>
> Top result being 100%, then all others normalised based on the
> maxScore, calculated outside of Solr.
>
> We now want to limit returned docs with a percentage score higher than
> say, 50%.
>
> e.g. We want to search but only return docs scoring above 80%, but
> want to sort by date, hence not being able to just sort by score.
>