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_r406046648
##########
File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
##########
@@ -302,20 +312,27 @@ private TopFieldCollector(FieldValueHitQueue<Entry> pq,
int numHits,
this.numHits = numHits;
this.hitsThresholdChecker = hitsThresholdChecker;
this.numComparators = pq.getComparators().length;
- FieldComparator<?> fieldComparator = pq.getComparators()[0];
+ FieldComparator<?> firstComparator = pq.getComparators()[0];
int reverseMul = pq.reverseMul[0];
- if
(fieldComparator.getClass().equals(FieldComparator.RelevanceComparator.class)
+ if
(firstComparator.getClass().equals(FieldComparator.RelevanceComparator.class)
&& reverseMul == 1 // if the natural sort is preserved (sort by
descending relevance)
&& hitsThresholdChecker.getHitsThreshold() != Integer.MAX_VALUE) {
- firstComparator = (FieldComparator.RelevanceComparator) fieldComparator;
+ relevanceComparator = (FieldComparator.RelevanceComparator)
firstComparator;
scoreMode = ScoreMode.TOP_SCORES;
canSetMinScore = true;
} else {
- firstComparator = null;
+ relevanceComparator = null;
scoreMode = needsScores ? ScoreMode.COMPLETE :
ScoreMode.COMPLETE_NO_SCORES;
canSetMinScore = false;
}
this.minScoreAcc = minScoreAcc;
+
+ if ((firstComparator instanceof FilteringFieldComparator) &&
(hitsThresholdChecker.getHitsThreshold() != Integer.MAX_VALUE)) {
Review comment:
Can we merge this with the `if` statement immediately above it? That way
`scoreMode` can stay final
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]