lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1049496 - in /lucene/dev/branches/bulkpostings/lucene/src: java/org/apache/lucene/index/ java/org/apache/lucene/index/codecs/intblock/ java/org/apache/lucene/index/codecs/preflex/ java/org/apache/lucene/index/codecs/sep/ java/org/apache/lu...
Date Wed, 15 Dec 2010 10:52:13 GMT
Author: mikemccand
Date: Wed Dec 15 10:52:12 2010
New Revision: 1049496

URL: http://svn.apache.org/viewvc?rev=1049496&view=rev
Log:
LUCENE-2723: cleanup the confusing offset()/end() semantics by having impls always pre-fill
buffer; spruce up BulkPostingsEnum's javadocs; move readVLong/next methods off of BulkPostingsEnum

Modified:
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/BulkPostingsEnum.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/DocsEnum.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/MultiBulkPostingsEnum.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/VariableIntBlockIndexInput.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/TermScorer.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/codecs/mocksep/MockSingleIntIndexInput.java

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/BulkPostingsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/BulkPostingsEnum.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/BulkPostingsEnum.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/BulkPostingsEnum.java
Wed Dec 15 10:52:12 2010
@@ -20,9 +20,11 @@ package org.apache.lucene.index;
 import java.io.IOException;
 
 /** Low level bulk iterator through postings (documents,
- *  term freq and positions).  This API shifts much
+ *  term freq, positions).  This API shifts much
  *  responsibility to the caller, in order to maximize
- *  performance:
+ *  performance (so that low-level intblock codecs can
+ *  directly share their internal buffer with the caller
+ *  without any further processing after decode):
  *
  *    * Caller must track and enforce docFreq limit
  *    * If omitTFAP is on, caller must handle null
@@ -33,8 +35,11 @@ import java.io.IOException;
  *    * Enforce skipDocs
  *    * Jump is not precise -- caller must still scan after
  *      a successful jump
- *    * Avoid reading too many ints, ie, impls of this API
- *      do not do bounds checking
+ *
+ *  When you first obtain a BulkPostingsEnum, and also after
+ *  a call to {@link #jump} that returns a non-null result,
+ *  the shared int[] buffers will contain valid data; use
+ *  offset/end to get the bounds.
  *
  *  @lucene.experimental */
 public abstract class BulkPostingsEnum {
@@ -43,53 +48,30 @@ public abstract class BulkPostingsEnum {
    *  there's data in the buffer.  Use offset/end to check. */
   public static abstract class BlockReader {
 
-    /** Returns int[] that holds each block. Call this once
-     *  up front before you start iterating. */
+    /** Returns shared int[] that holds each block. Call
+     *  this once up front before you start iterating. */
     public abstract int[] getBuffer();
-    
-    /** Read another block. Returns the count read, or 0 on
-     *  EOF. */
+
+    /** Read the next block.  Returns the count read, always
+     *  greater than 0 (it is the caller's responsibility to
+     *  not call this beyond the last block; there is no
+     *  internal bounds checking in implementations).
+     *  After fill, the offset (where valid data starts) is
+     *  always 0. */
     public abstract int fill() throws IOException;
 
-    /** End index plus 1 of valid data in the buffer */
+    /** End index plus 1 of valid data in the buffer. */
     public abstract int end();
 
-    /** Start index of valid data in the buffer */
+    /** Start index of valid data in the buffer.  This is
+     *  only valid after first obtaining a BulkPostingsEnum
+     *  or after a successful jump.  Once you call fill,
+     *  you should not call this method anymore (the offset
+     *  is always 0). */
     public abstract int offset();
 
     // nocommit messy
     public abstract void setOffset(int offset);
-
-    // nocommit messy
-    public int next() throws IOException {
-      final int[] buffer = getBuffer();
-      int offset = offset();
-      int end = end();
-      if (offset >= end) {
-        offset = 0;
-        end = fill();
-        if (offset >= end) {
-          // nocommit cleanup
-          throw new IOException("no more ints");
-        }
-      }
-      setOffset(1+offset);
-      return buffer[offset];
-    }
-
-    /** Reads long as 1 or 2 ints, and can only use 61 of
-     *  the 64 long bits. */
-    public long readVLong() throws IOException {
-      int offset = offset();
-      
-      final int v = next();
-      if ((v & 1) == 0) {
-        return v >> 1;
-      } else {
-        final long v2 = next();
-        return (v2 << 30) | (v >> 1);
-      }
-    }
   }
 
   public abstract BlockReader getDocDeltasReader() throws IOException;

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/DocsEnum.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/DocsEnum.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/DocsEnum.java
Wed Dec 15 10:52:12 2010
@@ -23,6 +23,10 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.util.AttributeSource;
 import org.apache.lucene.util.IntsRef;
 
+// nocommit -- this can always be wrapped on top of the
+// BulkPostingsEnum; maybe instead of each codec impl making
+// a separate DocsEnum, we always use a single wrapper?
+
 /** Iterates through the documents, term freq and positions.
  *  NOTE: you must first call {@link #nextDoc} before using
  *  any of the per-doc methods (this does not apply to the

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/MultiBulkPostingsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/MultiBulkPostingsEnum.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/MultiBulkPostingsEnum.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/MultiBulkPostingsEnum.java
Wed Dec 15 10:52:12 2010
@@ -93,13 +93,6 @@ public final class MultiBulkPostingsEnum
       currentLeft = subs[upto].docFreq;
       int limit = current.end();
       int offset = current.offset();
-      if (offset >= limit) {
-        //System.out.println("prefill limit=" + limit + " offs=" + offset + " current=" +
current);
-        limit = current.fill();
-        //System.out.println("  new limit=" + limit);
-      } else {
-        //System.out.println("  no prefill offset=" + offset + " limit=" + limit);
-      }
       if (limit > offset) {
         doCopy(offset, limit);
       }
@@ -143,10 +136,6 @@ public final class MultiBulkPostingsEnum
             //System.out.println("  fill current=" + current + " upto=" + upto + " this="
+ this);
             int limit = current.end();
             int offset = current.offset();
-            if (offset >= limit) {
-              //System.out.println("prefill2");
-              limit = current.fill();
-            }
             if (limit > offset) {
               return doCopy(offset, limit);
             }

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
Wed Dec 15 10:52:12 2010
@@ -142,6 +142,7 @@ public abstract class FixedIntBlockIndex
     private long fp;
     private int upto;
 
+    // This is used when reading skip data:
     @Override
     public void read(final IndexInput indexIn, final boolean absolute) throws IOException
{
       // nocommit -- somehow we should share the "upto" for
@@ -165,20 +166,21 @@ public abstract class FixedIntBlockIndex
       assert upto < blockSize;
     }
 
+    // This is used on index stored in terms dict
     @Override
     public void read(final BulkPostingsEnum.BlockReader indexIn, final boolean absolute)
throws IOException {
       if (absolute) {
-        fp = indexIn.readVLong();
-        upto = indexIn.next();
+        fp = readVLong(indexIn);
+        upto = next(indexIn);
       } else {
-        final long delta = indexIn.readVLong();
+        final long delta = readVLong(indexIn);
         if (delta == 0) {
           // same block
-          upto += indexIn.next();
+          upto += next(indexIn);
         } else {
           // new block
           fp += delta;
-          upto = indexIn.next();
+          upto = next(indexIn);
         }
       }
       assert upto < blockSize;

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/VariableIntBlockIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/VariableIntBlockIndexInput.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/VariableIntBlockIndexInput.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/intblock/VariableIntBlockIndexInput.java
Wed Dec 15 10:52:12 2010
@@ -77,8 +77,6 @@ public abstract class VariableIntBlockIn
 
     public final int[] pending;
 
-    private boolean seekPending;
-    private long pendingFP;
     private int offset;
     private long lastBlockFP;
     private int blockSize;
@@ -95,19 +93,25 @@ public abstract class VariableIntBlockIn
     void seek(final long fp, final int upto) throws IOException {
       //System.out.println("vintb seek fp=" + fp + " upto=" + upto);
       // TODO: should we do this in real-time, not lazy?
-      pendingFP = fp;
       offset = upto;
       assert offset >= 0: "pendingUpto=" + offset;
-      if (pendingFP != lastBlockFP) {
-        // Clear current block
-        seekPending = true;
-        //        System.out.println("  seekPending=true now fill");
-        fill();
+      if (fp != lastBlockFP) {
+        // Seek to new block
+        in.seek(fp);
+        blockReader.seek(fp);
+        lastBlockFP = fp;
+        limit = blockSize = blockReader.readBlock();
       } else {
+        // Seek w/in current block
         //System.out.println("  no seekPending");
       }
       //System.out.println("  now offset=" + offset + " limit=" + limit);
 
+      // TODO: if we were more clever when writing the
+      // index, such that a seek point wouldn't be written
+      // until the int encoder "committed", we could avoid
+      // this (likely minor) inefficiency:
+
       // This is necessary for int encoders that are
       // non-causal, ie must see future int values to
       // encode the current ones.
@@ -141,27 +145,11 @@ public abstract class VariableIntBlockIn
 
     @Override
     public int fill() throws IOException {
-      if (seekPending) {
-        seekPending = false;
-        in.seek(pendingFP);
-        blockReader.seek(pendingFP);
-        lastBlockFP = pendingFP;
-        blockSize = blockReader.readBlock();
-
-        // TODO: if we were more clever when writing the
-        // index, such that a seek point wouldn't be written
-        // until the int encoder "committed", we could avoid
-        // this (likely minor) inefficiency:
-
-        //System.out.println("varintblock.fill offset=" + offset + " vs blockSize=" + blockSize);
-
-      } else {
-        // nocommit -- not great that we do this on each
-        // fill -- but we need it to detect seek w/in block
-        // case:
-        lastBlockFP = in.getFilePointer();
-        blockSize = blockReader.readBlock();
-      }
+      // nocommit -- not great that we do this on each
+      // fill -- but we need it to detect seek w/in block
+      // case:
+      lastBlockFP = in.getFilePointer();
+      blockSize = blockReader.readBlock();
       return limit = blockSize;
     }
   }
@@ -170,6 +158,7 @@ public abstract class VariableIntBlockIn
     private long fp;
     private int upto;
 
+    // This is used when reading skip data:
     @Override
     public void read(final IndexInput indexIn, final boolean absolute) throws IOException
{
       if (absolute) {
@@ -191,20 +180,21 @@ public abstract class VariableIntBlockIn
       //assert upto < maxBlockSize: "upto=" + upto + " max=" + maxBlockSize;
     }
 
+    // This is used on index stored in terms dict
     @Override
     public void read(final BulkPostingsEnum.BlockReader indexIn, final boolean absolute)
throws IOException {
       if (absolute) {
-        fp = indexIn.readVLong();
-        upto = indexIn.next()&0xFF;
+        fp = readVLong(indexIn);
+        upto = next(indexIn)&0xFF;
       } else {
-        final long delta = indexIn.readVLong();
+        final long delta = readVLong(indexIn);
         if (delta == 0) {
           // same block
-          upto = indexIn.next()&0xFF;
+          upto = next(indexIn)&0xFF;
         } else {
           // new block
           fp += delta;
-          upto = indexIn.next()&0xFF;
+          upto = next(indexIn)&0xFF;
         }
       }
     }

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
Wed Dec 15 10:52:12 2010
@@ -1305,6 +1305,7 @@ public class PreFlexFields extends Field
 
       @Override
       public int fill() throws IOException {
+        // nocommit -- before fixing this, get a test to fail:
         // nocommit -- must "handle" EOF here -- cannot
         // change old index format!
         if (storePayloads) {

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java
Wed Dec 15 10:52:12 2010
@@ -57,4 +57,30 @@ public abstract class IntIndexInput impl
     
     public abstract Object clone();
   }
+
+
+  public static int next(BulkPostingsEnum.BlockReader reader) throws IOException {
+    final int[] buffer = reader.getBuffer();
+    int offset = reader.offset();
+    int end = reader.end();
+    if (offset >= end) {
+      offset = 0;
+      end = reader.fill();
+      assert offset < end;
+    }
+    reader.setOffset(1+offset);
+    return buffer[offset];
+  }
+
+  /** Reads long as 1 or 2 ints, and can only use 61 of
+   *  the 64 long bits. */
+  public static long readVLong(BulkPostingsEnum.BlockReader reader) throws IOException {
+    final int v = next(reader);
+    if ((v & 1) == 0) {
+      return v >> 1;
+    } else {
+      final long v2 = next(reader);
+      return (v2 << 30) | (v >> 1);
+    }
+  }
 }

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
Wed Dec 15 10:52:12 2010
@@ -270,29 +270,23 @@ public class SepPostingsReaderImpl exten
       docIndex.seek(docReader);
       docDeltaLimit = docReader.end();
       docDeltaUpto = docReader.offset();
-      if (docDeltaUpto >= docDeltaLimit) {
-        docDeltaLimit = docReader.fill();
-      }
 
       if (!omitTF) {
         freqIndex.read(docReader, true);
         freqIndex.seek(freqReader);
         freqUpto = freqReader.offset();
         freqLimit = freqReader.end();
-        if (freqUpto >= freqLimit) {
-          freqLimit = freqReader.fill();
-        }
         //System.out.println("  freqIndex=" + freqIndex + " posIndex=" + posIndex);
         
         posIndex.read(docReader, true);
         // nocommit -- only store this if storePayloads is true
         // skip payload offset
-        docReader.readVLong();
+        IntIndexInput.readVLong(docReader);
       } else {
         freq = 1;
       }
 
-      skipOffset = docReader.readVLong();
+      skipOffset = IntIndexInput.readVLong(docReader);
 
       docDeltaUpto = docReader.offset();
       docDeltaLimit = docReader.end();
@@ -418,9 +412,6 @@ public class SepPostingsReaderImpl exten
           skipper.getDocIndex().seek(docReader);
           docDeltaUpto = docReader.offset();
           docDeltaLimit = docReader.end();
-          if (docDeltaUpto >= docDeltaLimit) {
-            docDeltaLimit = docReader.fill();
-          }
 
           count = newCount;
           doc = skipper.getDoc();
@@ -511,27 +502,20 @@ public class SepPostingsReaderImpl exten
       docIndex.seek(docReader);
       docDeltaLimit = docReader.end();
       docDeltaUpto = docReader.offset();
-      if (docDeltaUpto >= docDeltaLimit) {
-        docDeltaLimit = docReader.fill();
-      }
 
       freqIndex.read(docReader, true);
       freqIndex.seek(freqReader);
       freqLimit = freqReader.end();
       freqUpto = freqReader.offset();
-      if (freqUpto >= freqLimit) {
-        //System.out.println("  re-fill freqs freqMax=" + freqLimit);
-        freqLimit = freqReader.fill();
-      }
       //System.out.println("  freqIndex=" + freqIndex);
 
       posIndex.read(docReader, true);
       posSeekPending = true;
       payloadPending = false;
 
-      payloadOffset = docReader.readVLong();
+      payloadOffset = IntIndexInput.readVLong(docReader);
       //System.out.println("  payloadOffset=" + payloadOffset);
-      skipOffset = docReader.readVLong();
+      skipOffset = IntIndexInput.readVLong(docReader);
       //System.out.println("  skipOffset=" + skipOffset);
 
       docDeltaLimit = docReader.end();
@@ -648,16 +632,10 @@ public class SepPostingsReaderImpl exten
           skipper.getFreqIndex().seek(freqReader);
           freqUpto = freqReader.offset();
           freqLimit = freqReader.end();
-          if (freqUpto >= freqLimit) {
-            freqLimit = freqReader.fill();
-          }
 
           skipper.getDocIndex().seek(docReader);
           docDeltaUpto = docReader.offset();
           docDeltaLimit = docReader.end();
-          if (docDeltaUpto >= docDeltaLimit) {
-            docDeltaLimit = docReader.fill();
-          }
 
           posIndex.set(skipper.getPosIndex());
           posSeekPending = true;
@@ -688,9 +666,6 @@ public class SepPostingsReaderImpl exten
         posIndex.seek(posReader);
         posLimit = posReader.end();
         posUpto = posReader.offset();
-        if (posUpto >= posLimit) {
-          posLimit = posReader.fill();
-        }
         payloadIn.seek(payloadOffset);
         posSeekPending = false;
       }
@@ -908,6 +883,13 @@ public class SepPostingsReaderImpl exten
     /** Position readers to the specified term */
     SepBulkPostingsEnum init(SepTermState termState) throws IOException {
 
+      // To reduce cost of scanning the terms dict, sep
+      // codecs store only the docDelta index in the terms
+      // dict, and then stuff the other term metadata (freq
+      // index, pos index, skip offset) into the front of
+      // the docDeltas.  So here we seek the docReader and
+      // decode this metadata:
+
       // nocommit -- make sure seek w/in buffer is efficient
       // here:
 
@@ -919,6 +901,10 @@ public class SepPostingsReaderImpl exten
       //System.out.println("  v[0]=" + docReader.getBuffer()[0]);
 
       if (!omitTF) {
+        // nocommit -- would be better (fewer bytes used) to
+        // make this a relative index read (pass false not
+        // true), eg relative to first term in the terms
+        // index block
         freqIndex.read(docReader, true);
         if (freqReader != null) {
           freqIndex.seek(freqReader);
@@ -926,10 +912,10 @@ public class SepPostingsReaderImpl exten
         posIndex.read(docReader, true);
         // skip payload offset -- nocommit only store this
         // if field has payloads
-        docReader.readVLong();
+        IntIndexInput.readVLong(docReader);
       }
 
-      skipOffset = docReader.readVLong();
+      skipOffset = IntIndexInput.readVLong(docReader);
       //System.out.println("skipOffset=" + skipOffset);
 
       if (posReader != null) {
@@ -942,11 +928,6 @@ public class SepPostingsReaderImpl exten
         }
       }
 
-      if (docReader.offset() >= docReader.end()) {
-        docReader.fill();
-        docReader.setOffset(0);
-      }
-
       docFreq = termState.docFreq;
       skipped = false;
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
Wed Dec 15 10:52:12 2010
@@ -134,9 +134,6 @@ public class MultiTermQueryWrapperFilter
         final int[] docDeltas = docDeltasReader.getBuffer();
         int offset = docDeltasReader.offset();
         int limit = docDeltasReader.end();
-        if (offset >= limit) {
-          limit = docDeltasReader.fill();
-        }
         int count = 0;
         int doc = 0;
         while (count < docFreq) {

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/TermScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/TermScorer.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/TermScorer.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/TermScorer.java
Wed Dec 15 10:52:12 2010
@@ -22,6 +22,9 @@ import java.io.IOException;
 import org.apache.lucene.index.BulkPostingsEnum;
 import org.apache.lucene.util.Bits;
 
+// nocommit -- break out aligned & not cases?
+// nocommit -- break out bulk vs doc-at-time scorer?
+
 /** Expert: A <code>Scorer</code> for documents matching a <code>Term</code>.
  */
 final class TermScorer extends Scorer {
@@ -69,9 +72,6 @@ final class TermScorer extends Scorer {
     docDeltas = docDeltasReader.getBuffer();
     docPointerMax = docDeltasReader.end();
     docPointer = docDeltasReader.offset();
-    if (docPointer >= docPointerMax) {
-      docPointerMax = docDeltasReader.fill();
-    }
     docPointer--;
 
     freqsReader = td.getFreqsReader();
@@ -79,9 +79,6 @@ final class TermScorer extends Scorer {
       freqs = freqsReader.getBuffer();
       freqPointerMax = freqsReader.end();
       freqPointer = freqsReader.offset();
-      if (freqPointer >= freqPointerMax) {
-        freqPointerMax = freqsReader.fill();
-      }
       freqPointer--;
     } else {
       freqs = null;
@@ -290,16 +287,10 @@ final class TermScorer extends Scorer {
       first = false;
       docPointer = docDeltasReader.offset();
       docPointerMax = docDeltasReader.end();
-      if (docPointer >= docPointerMax) {
-        docPointerMax = docDeltasReader.fill();
-      }
       docPointer--;
       if (freqsReader != null) {
         freqPointer = freqsReader.offset();
         freqPointerMax = freqsReader.end();
-        if (freqPointer >= freqPointerMax) {
-          freqPointerMax = freqsReader.fill();
-        }
         freqPointer--;
       }
     } else {

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
Wed Dec 15 10:52:12 2010
@@ -2953,8 +2953,6 @@ public class TestIndexWriter extends Luc
     }
     assertEquals(NUM_GAPS, upto);
 
-    final int maxDoc = r.maxDoc();
-
     // test advance:
     for(int i=0;i<NUM_GAPS;i++) {
       docs = MultiFields.getTermDocsEnum(r,
@@ -2982,9 +2980,6 @@ public class TestIndexWriter extends Luc
     int[] docDeltas = docDeltasReader.getBuffer();
     int docDeltaUpto = docDeltasReader.offset();
     int docDeltaMax = docDeltasReader.end();
-    if (docDeltaUpto >= docDeltaMax) {
-      docDeltaMax = docDeltasReader.fill();
-    }
     docID = 0;
     for(int i=0;i<NUM_GAPS;i++) {
       if (docDeltaUpto == docDeltaMax) {
@@ -3024,10 +3019,6 @@ public class TestIndexWriter extends Luc
       docDeltas = docDeltasReader.getBuffer();
       docDeltaUpto = docDeltasReader.offset();
       docDeltaMax = docDeltasReader.end();
-      if (docDeltaUpto >= docDeltaMax) {
-        docDeltaMax = docDeltasReader.fill();
-        //System.out.println("  do pre-fill");
-      }
       for(int j=count;j<NUM_GAPS;j++) {
         //System.out.println("  GAP j=" + j);
         if (docDeltaUpto >= docDeltaMax) {

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/codecs/mocksep/MockSingleIntIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/codecs/mocksep/MockSingleIntIndexInput.java?rev=1049496&r1=1049495&r2=1049496&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/codecs/mocksep/MockSingleIntIndexInput.java
(original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/codecs/mocksep/MockSingleIntIndexInput.java
Wed Dec 15 10:52:12 2010
@@ -108,9 +108,9 @@ public class MockSingleIntIndexInput ext
     public void read(BulkPostingsEnum.BlockReader indexIn, boolean absolute)
       throws IOException {
       if (absolute) {
-        fp = indexIn.readVLong();
+        fp = readVLong(indexIn);
       } else {
-        fp += indexIn.readVLong();
+        fp += readVLong(indexIn);
       }
     }
 



Mime
View raw message