lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r630377 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/SegmentTermEnum.java
Date Sat, 23 Feb 2008 02:35:15 GMT
Author: buschmi
Date: Fri Feb 22 18:35:14 2008
New Revision: 630377

URL: http://svn.apache.org/viewvc?rev=630377&view=rev
Log:
LUCENE-1185: Avoid checking if the TermBuffer 'scratch' in SegmentTermEnum is null for every
call of scanTo().

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermEnum.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=630377&r1=630376&r2=630377&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri Feb 22 18:35:14 2008
@@ -113,6 +113,10 @@
  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
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermEnum.java?rev=630377&r1=630376&r2=630377&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermEnum.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermEnum.java Fri Feb 22 18:35:14
2008
@@ -28,7 +28,7 @@
 
   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 @@
 
     clone.termBuffer = (TermBuffer)termBuffer.clone();
     clone.prevBuffer = (TermBuffer)prevBuffer.clone();
-    clone.scratch = null;
+    clone.scanBuffer = new TermBuffer();
 
     return clone;
   }
@@ -148,10 +148,8 @@
 
   /** 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.



Mime
View raw message