Skip to content

CLOUDP-415919 - Backports WANDScorer and leading wildcard query fixes to 10.4.0 - #20

Merged
txwei merged 4 commits into
mongot_10_4_0from
CLOUDP-415919
Jun 22, 2026
Merged

CLOUDP-415919 - Backports WANDScorer and leading wildcard query fixes to 10.4.0#20
txwei merged 4 commits into
mongot_10_4_0from
CLOUDP-415919

Conversation

@txwei

@txwei txwei commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR backports commits 01a6272 and 8c5a4be

@txwei
txwei changed the base branch from main to mongot_10_4_0 June 22, 2026 19:41
txwei and others added 2 commits June 22, 2026 12:47
Lucene apache#13408 (released in 10.0) dropped a guard in BooleanScorerSupplier.optionalBulkScorer that previously kept TOP_SCORES + minShouldMatch > 1 queries on WANDScorer. As a side effect, when matches are dense, dispatch now lands on BooleanScorer, which has no top-K impact pruning — causing 10–100× latency regressions on pure-should compound queries with minimumShouldMatch > 1.
MultiTermQuery constant-score wrapper now defers term collection to
ScorerSupplier#get() for queries with an unknown term count (automaton
queries such as wildcard/regexp/prefix/range), instead of scanning the
term dictionary while building the ScorerSupplier. This keeps the
ScorerSupplier "planning" phase cheap so a parent conjunction can
short-circuit (e.g. a sibling clause matching no documents) before a
non-seekable scan, such as a leading wildcard, runs.

If the term dictionary is large and a leading wildcard query matches very
few times (<16 (BOOLEAN_REWRITE_TERM_COUNT_THRESHOLD)), using
lazy instead of eager evaluation could save a lot of unnecessary term collection.
@txwei txwei changed the title CLOUDP 415919 CLOUDP-415919 - Backports WANDScorer and leading wildcard query fixes to 10.4.0 Jun 22, 2026
@txwei
txwei marked this pull request as ready for review June 22, 2026 20:09
@txwei
txwei requested a review from a team June 22, 2026 20:09
@txwei
txwei merged commit d3adc2a into mongot_10_4_0 Jun 22, 2026
9 checks passed
@txwei
txwei deleted the CLOUDP-415919 branch June 22, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants