diff --git a/src/java/org/apache/lucene/index/TermInfosReader.java b/src/java/org/apache/lucene/index/TermInfosReader.java index 7ca4f1048c1..47b6fabf5d3 100644 --- a/src/java/org/apache/lucene/index/TermInfosReader.java +++ b/src/java/org/apache/lucene/index/TermInfosReader.java @@ -246,7 +246,7 @@ final class TermInfosReader { if (size == 0) return null; SegmentTermEnum enumerator = getThreadResources().termEnum; - if (enumerator != null && enumerator.term() != null && + if (enumerator.term() != null && position >= enumerator.position && position < (enumerator.position + totalIndexInterval)) return scanEnum(enumerator, position); // can avoid seek