Quantcast

Early Termination of Queries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Early Termination of Queries

aravinth thangasami
Hi all,
*EarlyTerminatingSortingCollector* in lucene takes N documents from each
segment. I have a case where i need to get the result from latest
segment alone will be enough to provide the results.

On finding N results in latest segment i will stop searching


What is your opinion on this ??

will this is possible ???



Thanks
Aravinth
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Early Termination of Queries

Michael McCandless-2
Each segment in Lucene is its own little index, and you can get the
SegmentReader for it (use IndexReader.leaves() API from the full reader you
opened), pass that to IndexSearcher, and search it.

But be careful: the "last" segment is an unpredictable thing, because the
default merge policy merges segments out of order, so you can't know in
general what documents are in it, how large it will be, etc.

Mike McCandless

http://blog.mikemccandless.com

On Tue, Apr 18, 2017 at 6:07 AM, aravinth thangasami <
[hidden email]> wrote:

> Hi all,
> *EarlyTerminatingSortingCollector* in lucene takes N documents from each
> segment. I have a case where i need to get the result from latest
> segment alone will be enough to provide the results.
>
> On finding N results in latest segment i will stop searching
>
>
> What is your opinion on this ??
>
> will this is possible ???
>
>
>
> Thanks
> Aravinth
>
Loading...