List of usage examples for org.apache.solr.common.cloud ClusterState getCollectionOrNull
public DocCollection getCollectionOrNull(String collectionName)
From source file:com.thinkaurelius.titan.diskstorage.solr.Solr5Index.java
License:Apache License
/** * Checks if the collection has already been created in Solr. *//*from w w w.j a v a 2s . c o m*/ private static boolean checkIfCollectionExists(CloudSolrClient server, String collection) throws KeeperException, InterruptedException { ZkStateReader zkStateReader = server.getZkStateReader(); zkStateReader.updateClusterState(true); ClusterState clusterState = zkStateReader.getClusterState(); return clusterState.getCollectionOrNull(collection) != null; }
From source file:org.janusgraph.diskstorage.solr.SolrIndex.java
License:Apache License
/** * Checks if the collection has already been created in Solr. *///from w w w .ja va2s .co m private static boolean checkIfCollectionExists(CloudSolrClient server, String collection) throws KeeperException, InterruptedException { final ZkStateReader zkStateReader = server.getZkStateReader(); zkStateReader.forceUpdateCollection(collection); final ClusterState clusterState = zkStateReader.getClusterState(); return clusterState.getCollectionOrNull(collection) != null; }