Java Code Examples for org.apache.solr.client.solrj.request.UpdateRequest#ACTION

The following examples show how to use org.apache.solr.client.solrj.request.UpdateRequest#ACTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolrExampleStreamingTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testWaitOptions() throws Exception {
  // SOLR-3903
  final List<Throwable> failures = new ArrayList<>();
  final String serverUrl = jetty.getBaseUrl().toString() + "/collection1";
  try (ConcurrentUpdateSolrClient concurrentClient = new FailureRecordingConcurrentUpdateSolrClient.Builder(serverUrl)
      .withQueueSize(2)
      .withThreadCount(2)
      .build()) {
    int docId = 42;
    for (UpdateRequest.ACTION action : EnumSet.allOf(UpdateRequest.ACTION.class)) {
      for (boolean waitSearch : Arrays.asList(true, false)) {
        for (boolean waitFlush : Arrays.asList(true, false)) {
          UpdateRequest updateRequest = new UpdateRequest();
          SolrInputDocument document = new SolrInputDocument();
          document.addField("id", docId++);
          updateRequest.add(document);
          updateRequest.setAction(action, waitSearch, waitFlush);
          concurrentClient.request(updateRequest);
        }
      }
    }
    concurrentClient.commit();
    concurrentClient.blockUntilFinished();
  }

  if (0 != failures.size()) {
    assertEquals(failures.size() + " Unexpected Exception, starting with...", 
                 null, failures.get(0));
  }
}
 
Example 2
Source File: SolrExampleStreamingHttp2Test.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testWaitOptions() throws Exception {
  // SOLR-3903
  final List<Throwable> failures = new ArrayList<>();
  final String serverUrl = jetty.getBaseUrl().toString() + "/collection1";
  try (Http2SolrClient http2Client = new Http2SolrClient.Builder().build();
       ConcurrentUpdateHttp2SolrClient concurrentClient = new FailureRecordingConcurrentUpdateSolrClient.Builder(serverUrl, http2Client)
           .withQueueSize(2)
           .withThreadCount(2)
           .build()) {
    int docId = 42;
    for (UpdateRequest.ACTION action : EnumSet.allOf(UpdateRequest.ACTION.class)) {
      for (boolean waitSearch : Arrays.asList(true, false)) {
        for (boolean waitFlush : Arrays.asList(true, false)) {
          UpdateRequest updateRequest = new UpdateRequest();
          SolrInputDocument document = new SolrInputDocument();
          document.addField("id", docId++);
          updateRequest.add(document);
          updateRequest.setAction(action, waitSearch, waitFlush);
          concurrentClient.request(updateRequest);
        }
      }
    }
    concurrentClient.commit();
    concurrentClient.blockUntilFinished();
  }

  if (0 != failures.size()) {
    assertEquals(failures.size() + " Unexpected Exception, starting with...",
        null, failures.get(0));
  }
}