lucene-java-user mailing list archives

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


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
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message