Example usage for org.apache.solr.client.solrj.request UpdateRequest setWaitSearcher

List of usage examples for org.apache.solr.client.solrj.request UpdateRequest setWaitSearcher

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.request UpdateRequest setWaitSearcher.

Prototype

public void setWaitSearcher(boolean waitSearcher) 

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 .  java2s . c  o  m
    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);//  w  w w .j a  v a2  s . c o  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);
    }
}