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>
ConstructsLBHttpSolrClientinstances from provided configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>baseSolrUrlsstatic intCHECK_INTERVALprotected HttpSolrClient.BuilderhttpSolrClientBuilder-
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 LBHttpSolrClientbuild()Create aHttpSolrClientbased on provided configuration.HttpSolrClient.BuildergetHttpSolrClientBuilder()LBHttpSolrClient.BuildergetThis()The solution for the unchecked cast warning.LBHttpSolrClient.BuildersetAliveCheckInterval(int aliveCheckInterval)LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive.LBHttpSolrClient.BuilderwithBaseSolrUrl(String baseSolrUrl)Provide a Solr endpoint to be used when configuringLBHttpSolrClientinstances.LBHttpSolrClient.BuilderwithBaseSolrUrls(String... solrUrls)Provide Solr endpoints to be used when configuringLBHttpSolrClientinstances.LBHttpSolrClient.BuilderwithHttpSolrClientBuilder(HttpSolrClient.Builder builder)Provides aHttpSolrClient.Builderto 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 configuringLBHttpSolrClientinstances.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 configuringLBHttpSolrClientinstances.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.Builderto be used for building the internally used clients.
-
build
public LBHttpSolrClient build()
Create aHttpSolrClientbased on provided configuration.
-
getThis
public LBHttpSolrClient.Builder getThis()
Description copied from class:SolrClientBuilderThe solution for the unchecked cast warning.- Specified by:
getThisin classSolrClientBuilder<LBHttpSolrClient.Builder>
-
-