From 86d191ab730730a62905fb1b374b22260c8933bf Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 17 Jul 2024 23:00:18 +0200 Subject: [PATCH] Stop bounding outer window. Currently `MaxScoreBulkScorer` requires its "outer" window to be at least `WINDOW_SIZE`. The intuition there was that we should make sure we should use the whole range of the bit set that we are using to collect matches. The downside is that it may force us to use an upper level in the skip list that has worse upper bounds for the scores. luceneutil suggests that this is not a good trade-off: removing this requirement makes some queries a bit slower, but `OrHighMin` and `OrHighRare` much faster. --- .../java/org/apache/lucene/search/MaxScoreBulkScorer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java index f250abfbcb91..bce02cbdae61 100644 --- a/lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java @@ -271,11 +271,6 @@ private int computeOuterWindowMax(int windowMin) throws IOException { windowMax = (int) Math.min(windowMax, upTo + 1L); // upTo is inclusive } - // Score at least an entire inner window of docs - windowMax = - Math.max( - windowMax, (int) Math.min(Integer.MAX_VALUE, (long) windowMin + INNER_WINDOW_SIZE)); - return windowMax; }