romseygeek commented on a change in pull request #1351: LUCENE-9280: Collectors to skip noncompetitive documents URL: https://github.com/apache/lucene-solr/pull/1351#discussion_r407526518
########## File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java ########## @@ -432,6 +462,12 @@ static TopFieldCollector create(Sort sort, int numHits, FieldDoc after, throw new IllegalArgumentException("hitsThresholdChecker should not be null"); } + // here we assume that if hitsThreshold was set, we let the corresponding comparator to skip non-competitive docs + // It is beneficial for the 1st field only to skip non-competitive docs + if (hitsThresholdChecker.getHitsThreshold() != Integer.MAX_VALUE) { + sort.fields[0].allowFilterNonCompetitveDocs(); + } + Review comment: I think this should be done in `FieldValueHitQueue.create()` below - pass in a boolean to indicate that we want to skip hits if we can, and then do the wrapping/rewriting/whatever it ends up being as a part of building the sort queue ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org