elasticsearch/elasticsearch — pull request #3530 by Paikan (2013-08-18 07:19:21+00:00)
Title: Share shards computation logic between searchShards and searchShardsCoun...

This PR refactors a bit and add a shared method for searchShards and searchShardsCount to avoid divergent behavior in the future (like #2682 and #3268).

It seems like searchShardsCount is mainly implemented to test if we are hitting 1 shard or more than 1 shards so maybe it could be renamed and optimized for that specific use case.