LUCENE-2884: fix StandardPostingsReader's enums to not try to load skip data when there wasn't any

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1062908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-01-24 18:16:01 +00:00
parent 8d1994b2e3
commit 25f5488fd2
2 changed files with 11 additions and 7 deletions

View File

@ -514,7 +514,7 @@ public class BlockTermsReader extends FieldsProducer {
metadata, ie docFreq, totalTermFreq or pulls a D/&PEnum, we then (lazily)
decode all metadata up to the current term. */
private BytesRef _next() throws IOException {
//System.out.println("BTR._next this=" + this + " termCount=" + state.termCount + " (vs " + state.blockTermCount + ")");
//System.out.println("BTR._next seg=" + segment + " this=" + this + " termCount=" + state.termCount + " (vs " + state.blockTermCount + ")");
if (state.termCount == state.blockTermCount) {
if (!nextBlock()) {
//System.out.println(" eof");

View File

@ -172,11 +172,14 @@ public class StandardPostingsReader extends PostingsReaderBase {
} else {
termState.freqOffset += termState.bytesReader.readVLong();
}
//System.out.println(" dF=" + termState.docFreq);
//System.out.println(" freqFP=" + termState.freqOffset);
assert termState.freqOffset < freqIn.length();
if (termState.docFreq >= skipInterval) {
termState.skipOffset = termState.bytesReader.readVInt();
//System.out.println(" skipOffset=" + termState.skipOffset);
//System.out.println(" skipOffset=" + termState.skipOffset + " vs freqIn.length=" + freqIn.length());
assert termState.freqOffset + termState.skipOffset < freqIn.length();
} else {
// undefined
}
@ -375,7 +378,7 @@ public class StandardPostingsReader extends PostingsReaderBase {
// TODO: jump right to next() if target is < X away
// from where we are now?
if (skipOffset > 0) {
if (limit >= skipInterval) {
// There are enough docs in the posting to have
// skip data
@ -528,7 +531,7 @@ public class StandardPostingsReader extends PostingsReaderBase {
// TODO: jump right to next() if target is < X away
// from where we are now?
if (skipOffset > 0) {
if (limit >= skipInterval) {
// There are enough docs in the posting to have
// skip data
@ -670,7 +673,7 @@ public class StandardPostingsReader extends PostingsReaderBase {
freqOffset = termState.freqOffset;
proxOffset = termState.proxOffset;
skipOffset = termState.skipOffset;
//System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset);
//System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset + " this=" + this);
return this;
}
@ -720,10 +723,11 @@ public class StandardPostingsReader extends PostingsReaderBase {
@Override
public int advance(int target) throws IOException {
//System.out.println("StandardR.D&PE advance seg=" + segment + " target=" + target + " this=" + this);
// TODO: jump right to next() if target is < X away
// from where we are now?
if (skipOffset > 0) {
if (limit >= skipInterval) {
// There are enough docs in the posting to have
// skip data
@ -738,7 +742,7 @@ public class StandardPostingsReader extends PostingsReaderBase {
// This is the first time this posting has
// skipped, since reset() was called, so now we
// load the skip data for this posting
//System.out.println(" init skipper freqOffset=" + freqOffset + " skipOffset=" + skipOffset + " vs len=" + freqIn.length());
skipper.init(freqOffset+skipOffset,
freqOffset, proxOffset,
limit, true);