gaobinlong commented on code in PR #15574:
URL: https://github.com/apache/lucene/pull/15574#discussion_r3297125119


##########
lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java:
##########
@@ -1479,30 +1598,23 @@ private TopGroups<BytesRef> searchShards(
                 : ScoreMode.COMPLETE_NO_SCORES,
             1);
     final List<Collection<SearchGroup<BytesRef>>> shardGroups = new 
ArrayList<>();
-    List<FirstPassGroupingCollector<?>> firstPassGroupingCollectors = new 
ArrayList<>();
-    FirstPassGroupingCollector<?> firstPassCollector = null;
-
     String groupField = "group";
 
+    // TermGroupSelector or ValueSourceGroupSelector
+    final boolean isTermGroupSelector = random().nextBoolean();
+
     for (int shardIDX = 0; shardIDX < subSearchers.length; shardIDX++) {
+      final FirstPassGroupingCollectorManager<?> 
firstPassGroupingCollectorManager =
+          createFirstPassCollectorManager(
+              isTermGroupSelector, groupField, groupSort, 0, groupOffset + 
topNGroups);
 
-      // First shard determines whether we use IDV or not;
-      // all other shards match that:
-      if (firstPassCollector == null) {
-        firstPassCollector =
-            createRandomFirstPassCollector(groupField, groupSort, groupOffset 
+ topNGroups);
-      } else {
-        firstPassCollector =
-            createFirstPassCollector(
-                groupField, groupSort, groupOffset + topNGroups, 
firstPassCollector);
-      }
       if (VERBOSE) {
         System.out.println("  shard=" + shardIDX + " groupField=" + 
groupField);
-        System.out.println("    1st pass collector=" + firstPassCollector);
+        System.out.println("    1st pass collector manager=" + 
firstPassGroupingCollectorManager);
       }
-      firstPassGroupingCollectors.add(firstPassCollector);
-      subSearchers[shardIDX].search(w, firstPassCollector);
-      final Collection<SearchGroup<BytesRef>> topGroups = 
getSearchGroups(firstPassCollector, 0);
+      final Collection<SearchGroup<BytesRef>> topGroups =
+          toByteRefSearchGroups(
+              subSearchers[shardIDX].search(query, 
firstPassGroupingCollectorManager));

Review Comment:
   Thanks! Made some change for ShardSearcher following your instructions, 
please help to review.



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