lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dan sutton <danbsut...@gmail.com>
Subject Re: Custom comparator
Date Fri, 16 Jul 2010 08:42:37 GMT
Apologies I didn't make the requirement clear.

I need to keep the best N documents  - set A (chosen by some criteria - call
them sponsored docs) in front of the natural scoring docs  - set B so that I
return (A,B). The set A docs need to all score above 1% of maxScore in B
else they join the B set, though I don't really know maxScore until I've
looked at all the docs.

I am looking at the QueryElevationComponent for some hints, but any other
suggestions are appreciated.

Many thanks,
Dan

On Fri, Jul 16, 2010 at 12:03 AM, Erick Erickson <erickerickson@gmail.com>wrote:

> Hmmm, why do you need a custom collector? You can use
> the form of the search that returns a TopDocs, from which you
> can get the max score and the array of ScoreDoc each of which
> has its score. So you can just let the underlying code get the
> top N documents, and throw out any that don't score above
> 1%.
>
> HTH
> Erick
>
> On Thu, Jul 15, 2010 at 10:02 AM, dan sutton <danbsutton@gmail.com> wrote:
>
> > Hi,
> >
> > I have a requirement to have a custom comparator that keep the top N
> > documents (chosen by some criteria) but only if their score is more then
> > e.g. 1% of the maxScore.
> >
> > Looking at SolrIndexSearcher.java, I was hoping to have a custom
> > TopFieldCollector.java to return these via TopFieldCollector..topDocs,
> but
> > I
> > can't see how to override that class to provide my own, I think I need to
> > do
> > this here (TopFieldCollector..topDocs) as I won't know what the maxScore
> is
> > until all the docs have been collected and compared?
> >
> > Does anyone have any suggestions? I'd like to avoid having to do two
> > searches.
> >
> > Many Thanks,
> > Dan
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message