Example usage for org.apache.solr.common.cloud DocCollection getName

List of usage examples for org.apache.solr.common.cloud DocCollection getName

Introduction

In this page you can find the example usage for org.apache.solr.common.cloud DocCollection getName.

Prototype

public String getName() 

Source Link

Document

Return collection name.

Usage

From source file:com.shaie.solr.CollectionsStateHelper.java

License:Apache License

/** Returns all replicas per node. */
private Map<String, List<ReplicaInfo>> getNodeReplicas() {
    final ClusterState clusterState = getClusterState();
    final Map<String, List<ReplicaInfo>> result = Maps.newHashMap();
    for (final DocCollection collection : clusterState.getCollectionsMap().values()) {
        for (final Slice slice : collection.getSlices()) {
            for (final Replica replica : slice.getReplicas()) {
                List<ReplicaInfo> nodeReplicas = result.get(replica.getNodeName());
                if (nodeReplicas == null) {
                    nodeReplicas = Lists.newArrayList();
                    result.put(replica.getNodeName(), nodeReplicas);
                }/*from  www.j a va  2  s  .c  om*/
                nodeReplicas.add(new ReplicaInfo(replica, collection.getName(), slice.getName()));
            }
        }
    }
    return result;
}