Description
Group total are sometimes wrong when searching in solr cloud.
This can happen because the second phase of the search (get the records for the top n groups) is not being sent to all the shards. A list of shards that returned the top groups is created and then those shards are searched to get all the records for those groups. The problem happens when merging the results a shard may not return a group that is in the top n groups(it may have records in that group but was outside the top n) so that server is then skipped in the second phase.
eg.
search for top 3 groups
shard 1 Groups:Score
groupA : 1.5
groupB : 1.2
groupC : 1.1
shard 2
groupD : 0.9
groupE : 0.8
groupF : 0.4
this would merge to
groupA : 1.5
groupB : 1.2
groupC : 1.1
as after the merge no results came from shard 2 it is not searched (2nd phase)but it had a result groupA : 0.2 (score too low so not in top 3) so the count for the groupA are missing the records from shard 2.