Class LBHttpSolrClient.Builder
- java.lang.Object
-
- org.apache.solr.client.solrj.impl.SolrClientBuilder<LBHttpSolrClient.Builder>
-
- org.apache.solr.client.solrj.impl.LBHttpSolrClient.Builder
-
- Enclosing class:
- LBHttpSolrClient
public static class LBHttpSolrClient.Builder extends SolrClientBuilder<LBHttpSolrClient.Builder>
ConstructsLBHttpSolrClient
instances from provided configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
baseSolrUrls
static int
CHECK_INTERVAL
protected HttpSolrClient.Builder
httpSolrClientBuilder
-
Fields inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilder
connectionTimeoutMillis, followRedirects, httpClient, requestWriter, responseParser, socketTimeoutMillis, timeToLiveSeconds, urlParamNames, useMultiPartPost
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LBHttpSolrClient
build()
Create aHttpSolrClient
based on provided configuration.HttpSolrClient.Builder
getHttpSolrClientBuilder()
LBHttpSolrClient.Builder
getThis()
The solution for the unchecked cast warning.LBHttpSolrClient.Builder
setAliveCheckInterval(int aliveCheckInterval)
LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive.LBHttpSolrClient.Builder
withBaseSolrUrl(String baseSolrUrl)
Provide a Solr endpoint to be used when configuringLBHttpSolrClient
instances.LBHttpSolrClient.Builder
withBaseSolrUrls(String... solrUrls)
Provide Solr endpoints to be used when configuringLBHttpSolrClient
instances.LBHttpSolrClient.Builder
withHttpSolrClientBuilder(HttpSolrClient.Builder builder)
Provides aHttpSolrClient.Builder
to be used for building the internally used clients.-
Methods inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilder
allowMultiPartPost, withConnectionTimeout, withConnectionTimeout, withFollowRedirects, withHttpClient, withRequestWriter, withResponseParser, withSocketTimeout, withSocketTimeout, withTheseParamNamesInTheUrl
-
-
-
-
Field Detail
-
CHECK_INTERVAL
public static final int CHECK_INTERVAL
- See Also:
- Constant Field Values
-
httpSolrClientBuilder
protected HttpSolrClient.Builder httpSolrClientBuilder
-
-
Method Detail
-
getHttpSolrClientBuilder
public HttpSolrClient.Builder getHttpSolrClientBuilder()
-
withBaseSolrUrl
public LBHttpSolrClient.Builder withBaseSolrUrl(String baseSolrUrl)
Provide a Solr endpoint to be used when configuringLBHttpSolrClient
instances.Method may be called multiple times. All provided values will be used.
Two different paths can be specified as a part of the URL:
1) A path pointing directly at a particular core
SolrClient client = builder.withBaseSolrUrl("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 = builder.withBaseSolrUrl("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 is specified on all requests.
-
withBaseSolrUrls
public LBHttpSolrClient.Builder withBaseSolrUrls(String... solrUrls)
Provide Solr endpoints to be used when configuringLBHttpSolrClient
instances.Method may be called multiple times. All provided values will be used.
Two different paths can be specified as a part of each URL:
1) A path pointing directly at a particular core
SolrClient client = builder.withBaseSolrUrls("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 = builder.withBaseSolrUrls("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 is specified on all requests.
-
setAliveCheckInterval
public LBHttpSolrClient.Builder setAliveCheckInterval(int aliveCheckInterval)
LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive. Use this to set that interval- Parameters:
aliveCheckInterval
- time in milliseconds
-
withHttpSolrClientBuilder
public LBHttpSolrClient.Builder withHttpSolrClientBuilder(HttpSolrClient.Builder builder)
Provides aHttpSolrClient.Builder
to be used for building the internally used clients.
-
build
public LBHttpSolrClient build()
Create aHttpSolrClient
based on provided configuration.
-
getThis
public LBHttpSolrClient.Builder getThis()
Description copied from class:SolrClientBuilder
The solution for the unchecked cast warning.- Specified by:
getThis
in classSolrClientBuilder<LBHttpSolrClient.Builder>
-
-