Class ConcurrentUpdateSolrClient.Builder

java.lang.Object
org.apache.solr.client.solrj.apache.SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>
org.apache.solr.client.solrj.apache.ConcurrentUpdateSolrClient.Builder
Enclosing class:
ConcurrentUpdateSolrClient

public static class ConcurrentUpdateSolrClient.Builder extends SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>
Constructs ConcurrentUpdateSolrClient instances from provided configuration.
  • Field Details

    • baseSolrUrl

      protected String baseSolrUrl
    • queueSize

      protected int queueSize
    • threadCount

      protected int threadCount
    • pollQueueTime

      protected int pollQueueTime
    • executorService

      protected ExecutorService executorService
    • streamDeletes

      protected boolean streamDeletes
  • Constructor Details

    • Builder

      public Builder(String baseSolrUrl)
      Initialize a Builder object, based on the provided Solr URL.

      The provided URL must point to the root Solr path ("/solr"), for example:

         SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://my-solr-server:8983/solr")
             .withDefaultCollection("core1")
             .build();
         QueryResponse resp = client.query(new SolrQuery("*:*"));
       
  • Method Details

    • withQueueSize

      public ConcurrentUpdateSolrClient.Builder withQueueSize(int queueSize)
      The maximum number of requests buffered by the SolrClient's internal queue before being processed by background threads.

      This value should be carefully paired with the number of queue-consumer threads. A queue with a maximum size set too high may require more memory. A queue with a maximum size set too low may suffer decreased throughput as SolrClient.request(SolrRequest) calls block waiting to add requests to the queue.

      If not set, this defaults to 10.

      See Also:
    • withThreadCount

      public ConcurrentUpdateSolrClient.Builder withThreadCount(int threadCount)
      The maximum number of threads used to empty ConcurrentUpdateSolrClients queue.

      Threads are created when documents are added to the client's internal queue and exit when no updates remain in the queue.

      This value should be carefully paired with the maximum queue capacity. A client with too few threads may suffer decreased throughput as the queue fills up and SolrClient.request(SolrRequest) calls block waiting to add requests to the queue.

    • withPollQueueTime

      public ConcurrentUpdateSolrClient.Builder withPollQueueTime(int pollQueueTime)
    • withExecutorService

      public ConcurrentUpdateSolrClient.Builder withExecutorService(ExecutorService executorService)
      Provides the ExecutorService for the created client to use when servicing the update-request queue.
    • alwaysStreamDeletes

      public ConcurrentUpdateSolrClient.Builder alwaysStreamDeletes()
      Configures created clients to always stream delete requests.

      Streamed deletes are put into the update-queue and executed like any other update request.

    • neverStreamDeletes

      public ConcurrentUpdateSolrClient.Builder neverStreamDeletes()
      Configures created clients to not stream delete requests.

      With this option set when the created ConcurrentUpdateSolrClient sends a delete request it will first will lock the queue and block until all queued updates have been sent, and then send the delete request.

    • build

      Create a ConcurrentUpdateSolrClient based on the provided configuration options.
    • getThis

      Description copied from class: SolrClientBuilder
      The solution for the unchecked cast warning.
      Specified by:
      getThis in class SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>