LUCENE-10472: Fix TestMatchAllDocsQuery#testEarlyTermination (#753)

As part of #716 I moved the test to use a collector manager, but I forgot to update one of the assertions.
We can't rely on totalHits being accurate when the search is executed my multiple threads and early terminated.
This commit is contained in:
Luca Cavanna 2022-03-18 18:49:20 +01:00 committed by GitHub
parent 1dcb64b492
commit bb7568d865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -115,15 +115,15 @@ public class TestMatchAllDocsQuery extends LuceneTestCase {
}
IndexReader ir = DirectoryReader.open(iw);
IndexSearcher is = newSearcher(ir);
IndexSearcher singleThreadedSearcher = newSearcher(ir, true, true, false);
final int totalHitsThreshold = 200;
CollectorManager<TopScoreDocCollector, TopDocs> manager =
TopScoreDocCollector.createSharedManager(10, null, totalHitsThreshold);
TopDocs topDocs = is.search(new MatchAllDocsQuery(), manager);
TopDocs topDocs = singleThreadedSearcher.search(new MatchAllDocsQuery(), manager);
assertEquals(totalHitsThreshold + 1, topDocs.totalHits.value);
assertEquals(TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO, topDocs.totalHits.relation);
IndexSearcher is = newSearcher(ir);
manager = TopScoreDocCollector.createSharedManager(10, null, numDocs);
topDocs = is.search(new MatchAllDocsQuery(), manager);
assertEquals(numDocs, topDocs.totalHits.value);