refactor shard name logic (#878)
We had 2 copies of this logic in the code and this bit me when I
introduced id-based shards
indexbuilder.go seems an "ok" place to put. We cannot put it in the
shards package because of circular dependencies.
Test plan:
refactor, so relying on CI