use of com.qlangtech.tis.coredefine.module.action.CollectionTopology in project tis by qlangtech.
the class SolrCloudQueryResutStrategy method createCollectionTopology.
public CollectionTopology createCollectionTopology() {
CollectionTopology topology = new CollectionTopology();
TISZkStateReader clusterReader = runContext.getZkStateReader();
DocCollection docCollection = TISZkStateReader.getCollectionLive(clusterReader, domain.getAppName());
if (docCollection == null) {
throw new IllegalStateException("collection:" + domain.getAppName() + " relevant docCollection can not be null");
}
CollectionTopology.Shared shared = null;
Map<String, Slice> groups = docCollection.getSlicesMap();
short shard;
for (Map.Entry<String, Slice> entry : groups.entrySet()) {
shared = new CollectionTopology.Shared(entry.getKey());
topology.addShard(shared);
// shardName = entry.getKey();
for (Replica replic : entry.getValue().getReplicas()) {
shared.addReplic(replic);
// groupServer = new ServerJoinGroup();
// groupServer.setLeader(replic.getBool("leader", false));
// groupServer.setIpAddress(replic.getCoreUrl());
// shard = (Short.parseShort(StringUtils.substringAfter(entry.getKey(), SHARD_PREIX)));
// groupServer.setGroupIndex(--shard);
// result.add(groupServer);
}
}
return topology;
}
Aggregations