You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/01/30 14:03:21 UTC

svn commit: r1065261 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java

Author: rmuir
Date: Sun Jan 30 13:03:21 2011
New Revision: 1065261

URL: http://svn.apache.org/viewvc?rev=1065261&view=rev
Log:
LUCENE-2896: in advance(), don't skip when target doc delta is very small

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java?rev=1065261&r1=1065260&r2=1065261&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java Sun Jan 30 13:03:21 2011
@@ -375,13 +375,10 @@ public class StandardPostingsReader exte
     @Override
     public int advance(int target) throws IOException {
 
-      // TODO: jump right to next() if target is < X away
-      // from where we are now?
-
-      if (limit >= skipInterval) {
+      if ((target - skipInterval) >= doc && limit >= skipInterval) {
 
         // There are enough docs in the posting to have
-        // skip data
+        // skip data, and it isn't too close.
 
         if (skipper == null) {
           // This is the first time this enum has ever been used for skipping -- do lazy init
@@ -528,13 +525,10 @@ public class StandardPostingsReader exte
 
       //System.out.println("StandardR.D&PE advance target=" + target);
 
-      // TODO: jump right to next() if target is < X away
-      // from where we are now?
-
-      if (limit >= skipInterval) {
+      if ((target - skipInterval) >= doc && limit >= skipInterval) {
 
         // There are enough docs in the posting to have
-        // skip data
+        // skip data, and it isn't too close
 
         if (skipper == null) {
           // This is the first time this enum has ever been used for skipping -- do lazy init
@@ -724,13 +718,11 @@ public class StandardPostingsReader exte
     public int advance(int target) throws IOException {
 
       //System.out.println("StandardR.D&PE advance seg=" + segment + " target=" + target + " this=" + this);
-      // TODO: jump right to next() if target is < X away
-      // from where we are now?
 
-      if (limit >= skipInterval) {
+      if ((target - skipInterval) >= doc && limit >= skipInterval) {
 
         // There are enough docs in the posting to have
-        // skip data
+        // skip data, and it isn't too close
 
         if (skipper == null) {
           // This is the first time this enum has ever been used for skipping -- do lazy init