lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: Sort and Collector
Date Wed, 03 Feb 2010 18:53:52 GMT
On Wed, Feb 3, 2010 at 1:40 PM, tsuraan <tsuraan@gmail.com> wrote:
> Is there any way to run a search where I provide a Query, a Sort, and
> a Collector?  I have a case where it is sometimes, but rarely,
> necessary to get all the results from a query, but usually I'm
> satisfied with a smaller amount.  That part I can do with just a query
> and a collector, but I'd like the results to be sorted as they are
> submitted to the collector's collect method.  Is that possible?

It's not really possible.
Lucene must iterate over all of the hits before it knows for sure that
it has the top sorted by any criteria (other than docid).
A Collector is called for every hit as it happens, and thus one can't
specify a sort order (sorting itself is actually implemented with a
sorting Collector).

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message