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 <
aravinththangas...@gmail.com> 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
>

Reply via email to