Skip to content

Fix disabling of bulk scoring in monitor#16350

Merged
romseygeek merged 4 commits into
apache:mainfrom
romseygeek:monitor/disable-bulk-scoring
Jul 6, 2026
Merged

Fix disabling of bulk scoring in monitor#16350
romseygeek merged 4 commits into
apache:mainfrom
romseygeek:monitor/disable-bulk-scoring

Conversation

@romseygeek

Copy link
Copy Markdown
Contributor

The monitor wraps all queries in a ForceNoBulkScoringQuery to ensure that it runs everything doc-at-a-time and doesn't allocate large bulk buffers for searches over a tiny number of documents. Changes to the bulk scoring API in Weight and ScorerSupplier meant that this optimization was silently disabled.

Add a new test to ensure that bulk scoring is properly disabled, and re-work ForceNoBulkScoringQuery so that it behaves as expected.

The monitor wraps all queries in a ForceNoBulkScoringQuery to ensure
that it runs everything doc-at-a-time and doesn't allocate large
bulk buffers for searches over a tiny number of documents.  Changes
to the bulk scoring API in Weight and ScorerSupplier meant that this
optimization was silently disabled.

Add a new test to ensure that bulk scoring is properly disabled,
and re-work ForceNoBulkScoringQuery so that it behaves as expected.
@romseygeek romseygeek self-assigned this Jul 3, 2026
@romseygeek romseygeek merged commit 496df04 into apache:main Jul 6, 2026
7 of 8 checks passed
@romseygeek romseygeek deleted the monitor/disable-bulk-scoring branch July 6, 2026 13:15
romseygeek added a commit that referenced this pull request Jul 6, 2026
The monitor wraps all queries in a ForceNoBulkScoringQuery to ensure
that it runs everything doc-at-a-time and doesn't allocate large
bulk buffers for searches over a tiny number of documents.  Changes
to the bulk scoring API in Weight and ScorerSupplier meant that this
optimization was silently disabled.

Add a new test to ensure that bulk scoring is properly disabled,
and re-work ForceNoBulkScoringQuery so that it behaves as expected.
dweiss pushed a commit that referenced this pull request Jul 7, 2026
The sanity check added in #16350 assumes that searching the un-wrapped
ThrowsOnBulkScoreQuery always calls ScorerSupplier#bulkScorer. With
newSearcher(reader) the searcher may be an AssertingIndexSearcher,
whose ScorerSupplier sometimes builds the bulk scorer from scorer()
instead of delegating, so the expected AssertionError is never thrown:

  gradlew -p lucene/monitor test --tests TestForceNoBulkScoringQuery \
    -Dtests.seed=BDD18A3ADD885193

Use a plain IndexSearcher so the dispatch under test is deterministic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant