public static class ConcurrentUpdateSolrClient.Builder extends SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>
ConcurrentUpdateSolrClient
instances from provided configuration.Modifier and Type | Field and Description |
---|---|
protected String |
baseSolrUrl |
protected ExecutorService |
executorService |
protected int |
queueSize |
protected boolean |
streamDeletes |
protected int |
threadCount |
connectionTimeoutMillis, httpClient, responseParser, socketTimeoutMillis
Constructor and Description |
---|
Builder(String baseSolrUrl)
Create a Builder object, based on the provided Solr URL.
|
Modifier and Type | Method and Description |
---|---|
ConcurrentUpdateSolrClient.Builder |
alwaysStreamDeletes()
Configures created clients to always stream delete requests.
|
ConcurrentUpdateSolrClient |
build()
Create a
ConcurrentUpdateSolrClient based on the provided configuration options. |
ConcurrentUpdateSolrClient.Builder |
getThis()
The solution for the unchecked cast warning.
|
ConcurrentUpdateSolrClient.Builder |
neverStreamDeletes()
Configures created clients to not stream delete requests.
|
ConcurrentUpdateSolrClient.Builder |
withExecutorService(ExecutorService executorService)
Provides the
ExecutorService for the created client to use when servicing the update-request queue. |
ConcurrentUpdateSolrClient.Builder |
withQueueSize(int queueSize)
The maximum number of requests buffered by the SolrClient's internal queue before being processed by background threads.
|
ConcurrentUpdateSolrClient.Builder |
withThreadCount(int threadCount)
The maximum number of threads used to empty
ConcurrentUpdateSolrClient s queue. |
withConnectionTimeout, withHttpClient, withResponseParser, withSocketTimeout
protected String baseSolrUrl
protected int queueSize
protected int threadCount
protected ExecutorService executorService
protected boolean streamDeletes
public Builder(String baseSolrUrl)
SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://my-solr-server:8983/solr/core1").build(); QueryResponse resp = client.query(new SolrQuery("*:*"));Note that when a core is provided in the base URL, queries and other requests can be made without mentioning the core explicitly. However, the client can only send requests to that core. 2) The path of the root Solr path ("/solr")
SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://my-solr-server:8983/solr").build(); QueryResponse resp = client.query("core1", new SolrQuery("*:*"));In this case the client is more flexible and can be used to send requests to any cores. This flexibility though requires that the core be specified on all requests.
public ConcurrentUpdateSolrClient.Builder withQueueSize(int queueSize)
SolrClient.request(SolrRequest)
calls block waiting to add requests to the queue.
If not set, this defaults to 10.withThreadCount(int)
public ConcurrentUpdateSolrClient.Builder withThreadCount(int threadCount)
ConcurrentUpdateSolrClient
s 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.
public ConcurrentUpdateSolrClient.Builder withExecutorService(ExecutorService executorService)
ExecutorService
for the created client to use when servicing the update-request queue.public ConcurrentUpdateSolrClient.Builder alwaysStreamDeletes()
public ConcurrentUpdateSolrClient.Builder neverStreamDeletes()
public ConcurrentUpdateSolrClient build()
ConcurrentUpdateSolrClient
based on the provided configuration options.public ConcurrentUpdateSolrClient.Builder getThis()
SolrClientBuilder
getThis
in class SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.