gaobinlong commented on code in PR #16078:
URL: https://github.com/apache/lucene/pull/16078#discussion_r3264102786
##########
lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java:
##########
@@ -111,10 +114,14 @@ public void collect(int doc) throws IOException {
/** Returns the top docs that were collected by this collector. */
public TopDocs topDocs(int howMany) {
-
- if (howMany <= 0 || howMany > totalHits) {
- throw new IllegalArgumentException("Incorrect number of hits requested");
+ if (howMany < 0) {
+ throw new IllegalArgumentException(
+ "Number of hits requested must not be negative but value was " +
howMany);
+ }
+ if (howMany == 0) {
Review Comment:
0 comes from the public topDocs(), if totalHits is 0, then howMany equals to
0 here.
https://github.com/apache/lucene/blob/1d6c321274c590a67189b7b56e0c4e94a293ac15/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java#L165
--
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]