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/06 19:25:01 UTC
svn commit: r1369885 -
/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java
Author: mikemccand
Date: Mon Aug 6 17:25:00 2012
New Revision: 1369885
URL: http://svn.apache.org/viewvc?rev=1369885&view=rev
Log:
LUCENE-3892: inline nextDoc() for DocsAndPositionsEnum.advance
Modified:
lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java?rev=1369885&r1=1369884&r2=1369885&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java Mon Aug 6 17:25:00 2012
@@ -833,23 +833,43 @@ public final class BlockPostingsReader e
}
}
- // nocommit inline nextDoc here
+ // Now scan... this is an inlined/pared down version
+ // of nextDoc():
+ while (true) {
+ if (DEBUG) {
+ System.out.println(" scan doc=" + accum + " docBufferUpto=" + docBufferUpto);
+ }
+ 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++;
- // Now scan:
- while (nextDoc() != NO_MORE_DOCS) {
- if (doc >= target) {
- if (DEBUG) {
- System.out.println(" advance return doc=" + doc);
- }
- return doc;
+ if (accum >= target) {
+ break;
}
}
- if (DEBUG) {
- System.out.println(" advance return doc=END");
+ if (liveDocs == null || liveDocs.get(accum)) {
+ if (DEBUG) {
+ 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