lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Custom comparator
Date Thu, 15 Jul 2010 23:03:37 GMT
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