@@ -1375,13 +1375,6 @@ private TopGroups<BytesRef> searchShards(
13751375 + canUseIDV );
13761376 }
13771377 // Run 1st pass collector to get top groups per shard
1378- final Weight w =
1379- topSearcher .createWeight (
1380- topSearcher .rewrite (query ),
1381- groupSort .needsScores () || docSort .needsScores () || getMaxScores
1382- ? ScoreMode .COMPLETE
1383- : ScoreMode .COMPLETE_NO_SCORES ,
1384- 1 );
13851378 final List <Collection <SearchGroup <BytesRef >>> shardGroups = new ArrayList <>();
13861379 List <FirstPassGroupingCollector <?>> firstPassGroupingCollectors = new ArrayList <>();
13871380 FirstPassGroupingCollector <?> firstPassCollector = null ;
@@ -1405,6 +1398,10 @@ private TopGroups<BytesRef> searchShards(
14051398 System .out .println (" 1st pass collector=" + firstPassCollector );
14061399 }
14071400 firstPassGroupingCollectors .add (firstPassCollector );
1401+
1402+ final Weight w =
1403+ topSearcher .createWeight (topSearcher .rewrite (query ), firstPassCollector .scoreMode (), 1 );
1404+
14081405 subSearchers [shardIDX ].search (w , firstPassCollector );
14091406 final Collection <SearchGroup <BytesRef >> topGroups = getSearchGroups (firstPassCollector , 0 );
14101407 if (topGroups != null ) {
@@ -1462,6 +1459,11 @@ private TopGroups<BytesRef> searchShards(
14621459 docSort ,
14631460 docOffset + topNDocs ,
14641461 getMaxScores );
1462+
1463+ final Weight w =
1464+ topSearcher .createWeight (
1465+ topSearcher .rewrite (query ), secondPassCollector .scoreMode (), 1 );
1466+
14651467 subSearchers [shardIDX ].search (w , secondPassCollector );
14661468 shardTopGroups [shardIDX ] = getTopGroups (secondPassCollector , 0 );
14671469 if (VERBOSE ) {
0 commit comments