mirror of https://github.com/apache/lucene.git
LUCENE-951: Fixed NullPointerException in MultiLevelSkipListReader that was thrown after a call of TermPositions.seek().
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@555683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c8f84d6707
commit
7c612dcb2d
|
@ -23,6 +23,10 @@ Bug fixes
|
|||
|
||||
2. LUCENE-955: Fixed SegmentTermPositions to work correctly with the
|
||||
first term in the dictionary. (Michael Busch)
|
||||
|
||||
3. LUCENE-951: Fixed NullPointerException in MultiLevelSkipListReader
|
||||
that was thrown after a call of TermPositions.seek().
|
||||
(Rich Johnson via Michael Busch)
|
||||
|
||||
New features
|
||||
|
||||
|
|
|
@ -172,9 +172,11 @@ abstract class MultiLevelSkipListReader {
|
|||
this.docCount = df;
|
||||
Arrays.fill(skipDoc, 0);
|
||||
Arrays.fill(numSkipped, 0);
|
||||
Arrays.fill(childPointer, 0);
|
||||
|
||||
haveSkipped = false;
|
||||
for (int i = 1; i < numberOfSkipLevels; i++) {
|
||||
skipStream[0] = null;
|
||||
skipStream[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,18 +57,21 @@ public class TestMultiLevelSkipList extends TestCase {
|
|||
writer.close();
|
||||
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
SegmentTermPositions tp = (SegmentTermPositions) reader.termPositions(term);
|
||||
SegmentTermPositions tp = (SegmentTermPositions) reader.termPositions();
|
||||
tp.freqStream = new CountingStream(tp.freqStream);
|
||||
|
||||
tp.next();
|
||||
|
||||
checkSkipTo(tp, 14, 185); // no skips
|
||||
checkSkipTo(tp, 17, 190); // one skip on level 0
|
||||
checkSkipTo(tp, 287, 200); // one skip on level 1, two on level 0
|
||||
for (int i = 0; i < 2; i++) {
|
||||
counter = 0;
|
||||
tp.seek(term);
|
||||
|
||||
checkSkipTo(tp, 14, 185); // no skips
|
||||
checkSkipTo(tp, 17, 190); // one skip on level 0
|
||||
checkSkipTo(tp, 287, 200); // one skip on level 1, two on level 0
|
||||
|
||||
// this test would fail if we had only one skip level,
|
||||
// because than more bytes would be read from the freqStream
|
||||
checkSkipTo(tp, 4800, 250);// one skip on level 2
|
||||
// this test would fail if we had only one skip level,
|
||||
// because than more bytes would be read from the freqStream
|
||||
checkSkipTo(tp, 4800, 250);// one skip on level 2
|
||||
}
|
||||
}
|
||||
|
||||
public void checkSkipTo(TermPositions tp, int target, int maxCounter) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue