jainankitk commented on code in PR #15210:
URL: https://github.com/apache/lucene/pull/15210#discussion_r2467476126


##########
lucene/grouping/src/java/org/apache/lucene/search/grouping/FirstPassGroupingCollector.java:
##########
@@ -91,19 +95,34 @@ public FirstPassGroupingCollector(
     for (int i = 0; i < sortFields.length; i++) {
       final SortField sortField = sortFields[i];
 
+      final Pruning pruning;
+      if (i == 0) {
+        pruning = compIDXEnd >= 0 ? Pruning.GREATER_THAN : 
Pruning.GREATER_THAN_OR_EQUAL_TO;
+      } else {
+        pruning = Pruning.NONE;
+      }
+
       // use topNGroups + 1 so we have a spare slot to use for comparing 
(tracked by
       // this.spareSlot):
-      comparators[i] = sortField.getComparator(topNGroups + 1, Pruning.NONE);
+      comparators[i] = sortField.getComparator(topNGroups + 1, pruning);
       reversed[i] = sortField.getReverse() ? -1 : 1;
     }
 
+    if (SortField.FIELD_SCORE.equals(sortFields[0]) == true) {
+      scoreMode = ScoreMode.TOP_SCORES;
+      canSetMinScore = true;
+    } else {
+      scoreMode = groupSort.needsScores() ? ScoreMode.TOP_DOCS_WITH_SCORES : 
ScoreMode.TOP_DOCS;
+      canSetMinScore = false;

Review Comment:
   We don't need `ScoreMode.COMPLETE / ScoreMode.COMPLETE_NO_SCORES` here, 
since we don't have `totalHitsThreshold` like parameter?



##########
lucene/grouping/src/java/org/apache/lucene/search/grouping/FirstPassGroupingCollector.java:
##########
@@ -91,19 +95,34 @@ public FirstPassGroupingCollector(
     for (int i = 0; i < sortFields.length; i++) {
       final SortField sortField = sortFields[i];
 
+      final Pruning pruning;
+      if (i == 0) {
+        pruning = compIDXEnd >= 0 ? Pruning.GREATER_THAN : 
Pruning.GREATER_THAN_OR_EQUAL_TO;

Review Comment:
   Isn't pruning always equal to `Pruning.GREATER_THAN` since `compIDXEnd = 
sortFields.length - 1`?



-- 
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]

Reply via email to