From 9d41ed92911faf5c463c789a097c1f296b3c491b Mon Sep 17 00:00:00 2001 From: Jeho Jeong Date: Tue, 7 Jul 2026 14:37:02 +0900 Subject: [PATCH] Fix seed-dependent failure in TestForceNoBulkScoringQuery 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. --- .../apache/lucene/monitor/TestForceNoBulkScoringQuery.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/monitor/src/test/org/apache/lucene/monitor/TestForceNoBulkScoringQuery.java b/lucene/monitor/src/test/org/apache/lucene/monitor/TestForceNoBulkScoringQuery.java index ebd865f1a1a8..e7d39448e62a 100644 --- a/lucene/monitor/src/test/org/apache/lucene/monitor/TestForceNoBulkScoringQuery.java +++ b/lucene/monitor/src/test/org/apache/lucene/monitor/TestForceNoBulkScoringQuery.java @@ -94,7 +94,10 @@ public void testBulkScoringIsDisabled() throws IOException { iw.commit(); try (IndexReader reader = DirectoryReader.open(dir)) { - IndexSearcher searcher = newSearcher(reader); + // use a plain searcher: newSearcher may wrap with AssertingIndexSearcher, whose + // ScorerSupplier sometimes builds the bulk scorer from scorer() instead of delegating to + // bulkScorer(), which breaks the sanity check below for some seeds + IndexSearcher searcher = new IndexSearcher(reader); // disable query caching, so that we exercise the search path directly rather than // any bulk-scoring optimizations the cache may apply internally searcher.setQueryCache(null);