mirror of https://github.com/apache/lucene.git
LUCENE-1185: Avoid checking if the TermBuffer 'scratch' in SegmentTermEnum is null for every call of scanTo().
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@630377 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
850ffde6a6
commit
b86e8e9097
|
@ -113,6 +113,10 @@ Optimizations
|
|||
2. LUCENE-1120: Speed up merging of term vectors by bulk-copying the
|
||||
raw bytes for each contiguous range of non-deleted documents.
|
||||
(Mike McCandless)
|
||||
|
||||
3. LUCENE-1185: Avoid checking if the TermBuffer 'scratch' in
|
||||
SegmentTermEnum is null for every call of scanTo().
|
||||
(Christian Kohlschuetter via Michael Busch)
|
||||
|
||||
Documentation
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ final class SegmentTermEnum extends TermEnum implements Cloneable {
|
|||
|
||||
private TermBuffer termBuffer = new TermBuffer();
|
||||
private TermBuffer prevBuffer = new TermBuffer();
|
||||
private TermBuffer scratch; // used for scanning
|
||||
private TermBuffer scanBuffer = new TermBuffer(); // used for scanning
|
||||
|
||||
private TermInfo termInfo = new TermInfo();
|
||||
|
||||
|
@ -97,7 +97,7 @@ final class SegmentTermEnum extends TermEnum implements Cloneable {
|
|||
|
||||
clone.termBuffer = (TermBuffer)termBuffer.clone();
|
||||
clone.prevBuffer = (TermBuffer)prevBuffer.clone();
|
||||
clone.scratch = null;
|
||||
clone.scanBuffer = new TermBuffer();
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
@ -148,10 +148,8 @@ final class SegmentTermEnum extends TermEnum implements Cloneable {
|
|||
|
||||
/** Optimized scan, without allocating new terms. */
|
||||
final void scanTo(Term term) throws IOException {
|
||||
if (scratch == null)
|
||||
scratch = new TermBuffer();
|
||||
scratch.set(term);
|
||||
while (scratch.compareTo(termBuffer) > 0 && next()) {}
|
||||
scanBuffer.set(term);
|
||||
while (scanBuffer.compareTo(termBuffer) > 0 && next()) {}
|
||||
}
|
||||
|
||||
/** Returns the current Term in the enumeration.
|
||||
|
|
Loading…
Reference in New Issue