mayya-sharipova 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_r408522716
########## 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: @romseygeek Great suggestion to move wrapping into `FieldValueHitQueue`. I like the APIs more and more now. Addressed in c84fe5e. And also looks like we don't even need any changes to `SortField`, we can just wrap comparators. ---------------------------------------------------------------- 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