LUCENE-3892: fix producer in this test to pass -1 if we arent indexing offsets

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1364693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-07-23 15:58:24 +00:00
parent ec0eff6dcf
commit 163a5a1c0e
1 changed files with 2 additions and 1 deletions

View File

@ -386,6 +386,7 @@ public class TestPostingsFormat extends LuceneTestCase {
boolean doFreq = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
boolean doPos = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
boolean doPayloads = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
boolean doOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
TermsConsumer termsConsumer = fieldsConsumer.addField(fieldInfo);
long sumTotalTF = 0;
@ -417,7 +418,7 @@ public class TestPostingsFormat extends LuceneTestCase {
System.out.println(" pos=" + pos.position);
}
}
postingsConsumer.addPosition(pos.position, (doPayloads && pos.payload != null) ? new BytesRef(pos.payload) : null, pos.startOffset, pos.endOffset);
postingsConsumer.addPosition(pos.position, (doPayloads && pos.payload != null) ? new BytesRef(pos.payload) : null, doOffsets ? pos.startOffset : -1, doOffsets ? pos.endOffset : -1);
}
} else if (doFreq) {
totalTF += posting.positions.size();