Example usage for org.apache.solr.common.params UpdateParams COLLECTION

List of usage examples for org.apache.solr.common.params UpdateParams COLLECTION

Introduction

In this page you can find the example usage for org.apache.solr.common.params UpdateParams COLLECTION.

Prototype

String COLLECTION

To view the source code for org.apache.solr.common.params UpdateParams COLLECTION.

Click Source Link

Usage

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

License:Apache License

private void indexDocumentAndWaitForSync(String docId, String collectionName) {
    final SolrInputDocument doc = new SolrInputDocument();
    doc.setField("id", docId);
    final UpdateRequest docUpdate = new UpdateRequest();
    docUpdate.add(doc);/* w  w  w. ja  v  a2 s  .c om*/
    docUpdate.setParam(UpdateParams.COLLECTION, collectionName);
    docUpdate.setWaitSearcher(true);
    docUpdate.setParam(UpdateParams.SOFT_COMMIT, Boolean.TRUE.toString());
    try {
        final UpdateResponse response = docUpdate.process(solrClient);
        assertThat(response.getStatus()).isEqualTo(0);
        SolrCloudUtils.waitForReplicasToSync(collectionName, solrClient, WAIT_TIMEOUT_SECONDS);
    } catch (SolrServerException | IOException e) {
        throw new RuntimeException(e);
    }
}

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

License:Apache License

private void indexDocumentAndWaitForSync(String docId) {
    final SolrInputDocument doc = new SolrInputDocument();
    doc.setField("id", docId);
    final UpdateRequest docUpdate = new UpdateRequest();
    docUpdate.add(doc);/*from  ww w  .j  a  v a  2  s  .  co  m*/
    docUpdate.setParam(UpdateParams.COLLECTION, COLLECTION_NAME);
    docUpdate.setWaitSearcher(true);
    docUpdate.setParam(UpdateParams.SOFT_COMMIT, Boolean.TRUE.toString());
    try {
        final UpdateResponse response = docUpdate.process(solrClient);
        assertThat(response.getStatus()).isEqualTo(0);
        SolrCloudUtils.waitForReplicasToSync(COLLECTION_NAME, solrClient, WAIT_TIMEOUT_SECONDS);
    } catch (SolrServerException | IOException e) {
        throw new RuntimeException(e);
    }
}