lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andi rexha <>
Subject RE: Segment readers in Lucene 4.2
Date Tue, 02 Apr 2013 14:22:28 GMT

Thanks for the reply ;)

> this is all not public tot he code because it is also subject to change!
> With Lucene 4.x, you can assume:
> directoryReader.leaves().get(i) corresponds to
> WARNING: But this is only true if:
> - the reader is instanceof DirectoryReader
Yes, true. Thanks for the WARNING.

> - the segmentinfos were opened on the exact same commit point like the directory reader.
If you have IndexWriter concurrently committing in between, this is no longer correct. To
make this 100% correct, do DirectoryReader.listCommits(), chose one single "defined" commit
and use it for and the, commitPoint.getSegmentFileName()).
Ideally open the DirectoryReader first, so it holds a lock, so the segments file may not be
deleted before/while reading the segmentInfos.

Yes, I have a lock after each commit, and cache all the segments that are newly created.

Thank you, 
Best regards,
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message