Apache Lucene open-source search software
LUCENE-3892: move bufferSkip to startDoc
Michael McCandless1da92326c7a2
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.javaindex 94a3dfd4642..5ef1ea47bc7 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsWriter.java@@ -222,6 +222,15 @@ final class BlockPostingsWriter extends PostingsWriterBase {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 PostingsWriterBase {// the block was filled so it can save skip data)}+lastDocID = docID;lastPosition = 0;lastStartOffset = 0;@@ -313,19 +323,6 @@ final class BlockPostingsWriter extends PostingsWriterBase {@Overridepublic 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.