一切依旧 2017-04-11
CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost("127.0.0.1:2181").build();
final int zkClientTimeout = 10000;
final int zkConnectTimeout = 10000;
cloudSolrClient.setDefaultCollection(collection);
cloudSolrClient.setZkClientTimeout(zkClientTimeout);
cloudSolrClient.setZkConnectTimeout(zkConnectTimeout);
cloudSolrClient.add(doc1);
cloudSolrClient.commit();