mirror of https://github.com/apache/lucene.git
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:
parent
1dcb64b492
commit
bb7568d865
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue