javanna commented on code in PR #15660:
URL: https://github.com/apache/lucene/pull/15660#discussion_r3271935651
##########
lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java:
##########
@@ -92,92 +99,125 @@ public void testInvalidRequestedHitCount() {
public void testTopDocs() throws IOException {
IndexSearcher searcher = newSearcher(reader);
- LargeNumHitsTopDocsCollector largeCollector = new
LargeNumHitsTopDocsCollector(15);
+ LargeNumHitsTopDocsCollectorManager largeCollectorManager =
+ new LargeNumHitsTopDocsCollectorManager(15);
TopScoreDocCollectorManager regularCollectorManager =
new TopScoreDocCollectorManager(15, Integer.MAX_VALUE);
- searcher.search(testQuery, largeCollector);
- TopDocs topDocs = searcher.search(testQuery, regularCollectorManager);
+ TopDocs largeTopDocs = searcher.search(testQuery, largeCollectorManager);
+ TopDocs regularTopDocs = searcher.search(testQuery,
regularCollectorManager);
- assertEquals(largeCollector.totalHits, topDocs.totalHits.value());
+ assertEquals(largeTopDocs.totalHits.value(),
regularTopDocs.totalHits.value());
- IllegalArgumentException expected =
- expectThrows(IllegalArgumentException.class, () ->
largeCollector.topDocs(-1));
-
- assertTrue(expected.getMessage().contains("Number of hits requested must
not be negative"));
-
- assertEquals(EMPTY_TOPDOCS, largeCollector.topDocs(0));
- assertEquals(largeCollector.totalHits,
largeCollector.topDocs(35_000).totalHits.value());
+ LargeNumHitsTopDocsCollector collector =
largeCollectorManager.newCollector();
+ assertEquals(EMPTY_TOPDOCS, collector.topDocs(0));
+ assertEquals(collector.totalHits,
collector.topDocs(35_000).totalHits.value());
Review Comment:
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]