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 01:33:00 UTC
svn commit: r1369703 -
/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsReader.java
Author: mikemccand
Date: Sun Aug 5 23:33:00 2012
New Revision: 1369703
URL: http://svn.apache.org/viewvc?rev=1369703&view=rev
Log:
LUCENE-3892: inline scanning after DocsEnum.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=1369703&r1=1369702&r2=1369703&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 Sun Aug 5 23:33:00 2012
@@ -295,10 +295,10 @@ public final class BlockPostingsReader e
throws IOException {
boolean indexHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
- boolean indexHasPayloasd = fieldInfo.hasPayloads();
+ boolean indexHasPayloads = fieldInfo.hasPayloads();
if ((!indexHasOffsets || (flags & DocsAndPositionsEnum.FLAG_OFFSETS) == 0) &&
- (!fieldInfo.hasPayloads() || (flags & DocsAndPositionsEnum.FLAG_PAYLOADS) == 0)) {
+ (!indexHasPayloads || (flags & DocsAndPositionsEnum.FLAG_PAYLOADS) == 0)) {
BlockDocsAndPositionsEnum docsAndPositionsEnum;
if (reuse instanceof BlockDocsAndPositionsEnum) {
docsAndPositionsEnum = (BlockDocsAndPositionsEnum) reuse;
@@ -521,19 +521,43 @@ public final class BlockPostingsReader e
}
}
- // Now scan:
- while (nextDoc() != NO_MORE_DOCS) {
- if (doc >= target) {
- if (DEBUG) {
- System.out.println(" advance return doc=" + doc);
- }
- return doc;
+ // 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];
+ docUpto++;
+
+ if (accum >= target) {
+ break;
}
+ docBufferUpto++;
}
- if (DEBUG) {
- System.out.println(" advance return doc=END");
+
+ if (liveDocs == null || liveDocs.get(accum)) {
+ if (DEBUG) {
+ System.out.println(" return doc=" + accum);
+ }
+ freq = freqBuffer[docBufferUpto];
+ docBufferUpto++;
+ return doc = accum;
+ } else {
+ if (DEBUG) {
+ System.out.println(" now do nextDoc()");
+ }
+ docBufferUpto++;
+ return nextDoc();
}
- return NO_MORE_DOCS;
}
}
@@ -809,6 +833,8 @@ public final class BlockPostingsReader e
}
}
+ // nocommit inline nextDoc here
+
// Now scan:
while (nextDoc() != NO_MORE_DOCS) {
if (doc >= target) {
@@ -1281,6 +1307,8 @@ public final class BlockPostingsReader e
}
}
+ // nocommit inline nextDoc here
+
// Now scan:
while (nextDoc() != NO_MORE_DOCS) {
if (doc >= target) {