LUCENE-3892: move bufferSkip to startDoc

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1373367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-08-15 12:27:36 +00:00
parent 1c637c5e9b
commit 1da92326c7
1 changed files with 10 additions and 13 deletions

View File

@ -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 {
@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.