From de55bd4de125d5d8b5d89c1b7b3ec2224f93f8ca Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sun, 30 Jan 2011 13:03:21 +0000 Subject: [PATCH] LUCENE-2896: in advance(), don't skip when target doc delta is very small git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1065261 13f79535-47bb-0310-9956-ffa450edef68 --- .../standard/StandardPostingsReader.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java b/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java index 707bb43dec1..0e53a99d536 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java @@ -375,13 +375,10 @@ public class StandardPostingsReader extends PostingsReaderBase { @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 extends PostingsReaderBase { //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 extends PostingsReaderBase { 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