diff --git a/lucene/sandbox/src/test/org/apache/lucene/search/intervals/TestIntervals.java b/lucene/sandbox/src/test/org/apache/lucene/search/intervals/TestIntervals.java index 0dee62fb944..03085504182 100644 --- a/lucene/sandbox/src/test/org/apache/lucene/search/intervals/TestIntervals.java +++ b/lucene/sandbox/src/test/org/apache/lucene/search/intervals/TestIntervals.java @@ -153,6 +153,7 @@ public class TestIntervals extends LuceneTestCase { int ord = ReaderUtil.subIndex(doc, searcher.getIndexReader().leaves()); LeafReaderContext ctx = searcher.getIndexReader().leaves().get(ord); IntervalIterator it = source.intervals(field, ctx); + doc = doc - ctx.docBase; assertEquals(doc, it.advance(doc)); for (int expectedGap : expectedGaps) { if (it.nextInterval() == IntervalIterator.NO_MORE_INTERVALS) {