lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <>
Subject Re: Grouping on multiple shards possible in lucene?
Date Tue, 20 Nov 2012 13:09:01 GMT
On 11/20/2012 6:49 AM, Michael McCandless wrote:
> On Tue, Nov 20, 2012 at 1:49 AM, Ravikumar Govindarajan
> <> wrote:
>> Also, for a TopN query sorted by doc-id will the query terminate early?
> Actually, it won't!  But it really should ... you could make a
> Collector that throws an exception once the N docs have been
> collected?
I've never much liked this exception-throwing for early termination - 
IMO Lucene should really expose an Iterator-style API for pulling 
matches so that callers can choose when to terminate.  I've been writing 
an XQuery service that uses Lucene as its data storage and retrieval 
engine.  XQuery is entirely design to be lazily evaluated - everything 
is iterators from top to bottom, and the entire language is designed to 
be streamed so that all expressions can be terminated early.  For this 
case I really needed early termination to be controlled *by the caller*, 
since the conditions for early termination are unknowable.  So I wrote 
the attached class, which provides that by extending IndexSearcher.

Of course it would be nice if someone up to speed w/Lucene 4 would like 
to provide something similar built in to Lucene...


View raw message