Hi, 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 segmentsinfos.info(i) > > 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 DirectoryReader.open(CommitPoint) and the segmentInfos.read(Dir, > 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, Andi