mirror of https://github.com/apache/lucene.git
LUCENE-3892: inline nextDoc() for DocsAndPositionsEnum.advance
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1369885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4c27acb1a
commit
7bf0d1f804
|
@ -833,23 +833,43 @@ public final class BlockPostingsReader extends PostingsReaderBase {
|
|||
}
|
||||
}
|
||||
|
||||
// nocommit inline nextDoc here
|
||||
|
||||
// Now scan:
|
||||
while (nextDoc() != NO_MORE_DOCS) {
|
||||
if (doc >= target) {
|
||||
// Now scan... this is an inlined/pared down version
|
||||
// of nextDoc():
|
||||
while (true) {
|
||||
if (DEBUG) {
|
||||
System.out.println(" advance return doc=" + doc);
|
||||
System.out.println(" scan doc=" + accum + " docBufferUpto=" + docBufferUpto);
|
||||
}
|
||||
return doc;
|
||||
if (docUpto == docFreq) {
|
||||
return doc = NO_MORE_DOCS;
|
||||
}
|
||||
if (docBufferUpto == blockSize) {
|
||||
// nocommit hmm skip freq? but: we don't ever
|
||||
// scan over more than one block?
|
||||
refillDocs();
|
||||
}
|
||||
accum += docDeltaBuffer[docBufferUpto];
|
||||
freq = freqBuffer[docBufferUpto];
|
||||
posPendingCount += freq;
|
||||
docBufferUpto++;
|
||||
docUpto++;
|
||||
|
||||
if (accum >= target) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (liveDocs == null || liveDocs.get(accum)) {
|
||||
if (DEBUG) {
|
||||
System.out.println(" advance return doc=END");
|
||||
System.out.println(" return doc=" + accum);
|
||||
}
|
||||
position = 0;
|
||||
return doc = accum;
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
System.out.println(" now do nextDoc()");
|
||||
}
|
||||
return nextDoc();
|
||||
}
|
||||
|
||||
return NO_MORE_DOCS;
|
||||
}
|
||||
|
||||
// nocommit in theory we could avoid loading frq block
|
||||
|
|
Loading…
Reference in New Issue