Apache Lucene open-source search software
LUCENE-8980: Blocktree seekExact now checks min-max range of the segment
johngqjiang99f4cec45917
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex cb969eb3388..456843db04c 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -160,6 +160,9 @@ the total hits is not requested.* LUCENE-8939: Introduce shared count based early termination across multiple slices(Atri Sharma)+* LUCENE-8980: Blocktree's seekExact now short-circuits false if the term isn't in the min-max range of the segment.+ Large perf gain for ID/time like data when populated sequentially. (Guoqiang Jiang)+Bug Fixes* LUCENE-8755: spatial-extras quad and packed quad prefix trees could throw adiff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.javaindex 92888d060c9..587aaeb12e6 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java@@ -321,6 +321,10 @@ final class SegmentTermsEnum extends BaseTermsEnum {throw new IllegalStateException("terms index was not loaded");}+ if (fr.size() > 0 && (target.compareTo(fr.getMin()) < 0 || target.compareTo(fr.getMax()) > 0)) {+ return false;+ }+term.grow(1 + target.length);assert clearEOF();