lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r480147 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/MultiReader.java
Date Tue, 28 Nov 2006 18:17:57 GMT
Author: yonik
Date: Tue Nov 28 10:17:56 2006
New Revision: 480147

URL: http://svn.apache.org/viewvc?view=rev&rev=480147
Log:
non-recursive MultiTermDocs.next,skipTo: LUCENE-729

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

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=480147&r1=480146&r2=480147
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Tue Nov 28 10:17:56 2006
@@ -275,6 +275,10 @@
      with calls to System.arraycopy instead, in DocumentWriter.java.
      (Nicolas Lalevee via Mike McCandless)
 
+ 13. LUCENE-729: Non-recursive skipTo and next implementation of
+     TermDocs for a MultiReader.  The old implementation could
+     recurse up to the number of segments in the index. (Yonik Seeley)
+
 Test Cases
   1. Added TestTermScorer.java (Grant Ingersoll)
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java?view=diff&rev=480147&r1=480146&r2=480147
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java Tue Nov 28 10:17:56
2006
@@ -352,14 +352,17 @@
   }
 
   public boolean next() throws IOException {
-    if (current != null && current.next()) {
-      return true;
-    } else if (pointer < readers.length) {
-      base = starts[pointer];
-      current = termDocs(pointer++);
-      return next();
-    } else
-      return false;
+    for(;;) {
+      if (current!=null && current.next()) {
+        return true;
+      }
+      else if (pointer < readers.length) {
+        base = starts[pointer];
+        current = termDocs(pointer++);
+      } else {
+        return false;
+      }
+    }
   }
 
   /** Optimized implementation. */
@@ -385,16 +388,17 @@
     }
   }
 
- /* A Possible future optimization could skip entire segments */
+ /* A Possible future optimization could skip entire segments */ 
   public boolean skipTo(int target) throws IOException {
-    if (current != null && current.skipTo(target-base)) {
-      return true;
-    } else if (pointer < readers.length) {
-      base = starts[pointer];
-      current = termDocs(pointer++);
-      return skipTo(target);
-    } else
-      return false;
+    for(;;) {
+      if (current != null && current.skipTo(target-base)) {
+        return true;
+      } else if (pointer < readers.length) {
+        base = starts[pointer];
+        current = termDocs(pointer++);
+      } else
+        return false;
+    }
   }
 
   private TermDocs termDocs(int i) throws IOException {



Mime
View raw message