LUCENE-2559: add SegmentReader.reopen

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@980436 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-07-29 13:10:52 +00:00
parent 1a153246d1
commit 317b939949
2 changed files with 15 additions and 0 deletions

View File

@ -193,6 +193,9 @@ New features
SegmentInfosReader to allow customization of SegmentInfos data.
(Andrzej Bialecki)
* LUCENE-2559: Added SegmentReader.reopen methods (John Wang via Mike
McCandless)
Optimizations
* LUCENE-2410: ~20% speedup on exact (slop=0) PhraseQuery matching.

View File

@ -611,6 +611,18 @@ public class SegmentReader extends IndexReader implements Cloneable {
return reopenSegment(si, true, openReadOnly);
}
@Override
public synchronized IndexReader reopen()
throws CorruptIndexException, IOException {
return reopenSegment(si, false, readOnly);
}
@Override
public synchronized IndexReader reopen(boolean openReadOnly)
throws CorruptIndexException, IOException {
return reopenSegment(si, false, openReadOnly);
}
synchronized SegmentReader reopenSegment(SegmentInfo si, boolean doClone, boolean openReadOnly) throws CorruptIndexException, IOException {
boolean deletionsUpToDate = (this.si.hasDeletions() == si.hasDeletions())
&& (!si.hasDeletions() || this.si.getDelFileName().equals(si.getDelFileName()));