You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/08/15 14:27:37 UTC

svn commit: r1373367 - /lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java

Author: mikemccand
Date: Wed Aug 15 12:27:36 2012
New Revision: 1373367

URL: http://svn.apache.org/viewvc?rev=1373367&view=rev
Log:
LUCENE-3892: move bufferSkip to startDoc

Modified:
    lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java

Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java?rev=1373367&r1=1373366&r2=1373367&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java Wed Aug 15 12:27:36 2012
@@ -222,6 +222,15 @@ final class BlockPostingsWriter extends 
     if (DEBUG) {
       System.out.println("FPW.startDoc docID["+docBufferUpto+"]=" + docID);
     }
+    // Have collected a block of docs, and get a new doc. 
+    // Should write skip data as well as postings list for
+    // current block.
+    if (lastBlockDocID != -1 && docBufferUpto == 0) {
+      if (DEBUG) {
+        System.out.println("  bufferSkip at writeBlock: lastDocID=" + lastBlockDocID + " docCount=" + (docCount-1));
+      }
+      skipWriter.bufferSkip(lastBlockDocID, docCount, lastBlockPosFP, lastBlockPayFP, lastBlockPosBufferUpto, lastBlockStartOffset, lastBlockPayloadByteUpto);
+    }
 
     final int docDelta = docID - lastDocID;
 
@@ -255,6 +264,7 @@ final class BlockPostingsWriter extends 
       // the block was filled so it can save skip data)
     }
 
+
     lastDocID = docID;
     lastPosition = 0;
     lastStartOffset = 0;
@@ -313,19 +323,6 @@ final class BlockPostingsWriter extends 
 
   @Override
   public void finishDoc() throws IOException {
-    // Have collected a block of docs, and get a new doc. 
-    // Should write skip data as well as postings list for
-    // current block
-
-    if (lastBlockDocID != -1 && docBufferUpto == 1) {
-      // nocomit move to startDoc?  ie we can write skip
-      // data as soon as the next doc starts...
-      if (DEBUG) {
-        System.out.println("  bufferSkip at writeBlock: lastDocID=" + lastBlockDocID + " docCount=" + (docCount-1));
-      }
-      skipWriter.bufferSkip(lastBlockDocID, docCount-1, lastBlockPosFP, lastBlockPayFP, lastBlockPosBufferUpto, lastBlockStartOffset, lastBlockPayloadByteUpto);
-    }
-
     // Since we don't know df for current term, we had to buffer
     // those skip data for each block, and when a new doc comes, 
     // write them to skip file.