@@ -1375,13 +1375,6 @@ private TopGroups<BytesRef> searchShards(
1375
1375
+ canUseIDV );
1376
1376
}
1377
1377
// 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 );
1385
1378
final List <Collection <SearchGroup <BytesRef >>> shardGroups = new ArrayList <>();
1386
1379
List <FirstPassGroupingCollector <?>> firstPassGroupingCollectors = new ArrayList <>();
1387
1380
FirstPassGroupingCollector <?> firstPassCollector = null ;
@@ -1405,6 +1398,10 @@ private TopGroups<BytesRef> searchShards(
1405
1398
System .out .println (" 1st pass collector=" + firstPassCollector );
1406
1399
}
1407
1400
firstPassGroupingCollectors .add (firstPassCollector );
1401
+
1402
+ final Weight w =
1403
+ topSearcher .createWeight (topSearcher .rewrite (query ), firstPassCollector .scoreMode (), 1 );
1404
+
1408
1405
subSearchers [shardIDX ].search (w , firstPassCollector );
1409
1406
final Collection <SearchGroup <BytesRef >> topGroups = getSearchGroups (firstPassCollector , 0 );
1410
1407
if (topGroups != null ) {
@@ -1462,6 +1459,11 @@ private TopGroups<BytesRef> searchShards(
1462
1459
docSort ,
1463
1460
docOffset + topNDocs ,
1464
1461
getMaxScores );
1462
+
1463
+ final Weight w =
1464
+ topSearcher .createWeight (
1465
+ topSearcher .rewrite (query ), secondPassCollector .scoreMode (), 1 );
1466
+
1465
1467
subSearchers [shardIDX ].search (w , secondPassCollector );
1466
1468
shardTopGroups [shardIDX ] = getTopGroups (secondPassCollector , 0 );
1467
1469
if (VERBOSE ) {
0 commit comments