Share shards computation logic between searchShards and searchShardsCount