public static class HttpSolrClient.Builder extends SolrClientBuilder<HttpSolrClient.Builder>
HttpSolrClient
instances from provided configuration.Modifier and Type | Field and Description |
---|---|
protected String |
baseSolrUrl |
protected boolean |
compression |
protected ModifiableSolrParams |
invariantParams |
connectionTimeoutMillis, httpClient, responseParser, socketTimeoutMillis
Constructor and Description |
---|
Builder() |
Builder(String baseSolrUrl)
Create a Builder object, based on the provided Solr URL.
|
Modifier and Type | Method and Description |
---|---|
HttpSolrClient.Builder |
allowCompression(boolean compression)
Chooses whether created
HttpSolrClient s use compression by default. |
HttpSolrClient |
build()
Create a
HttpSolrClient based on provided configuration. |
HttpSolrClient.Builder |
getThis()
The solution for the unchecked cast warning.
|
HttpSolrClient.Builder |
withBaseSolrUrl(String baseSolrUrl)
Specify the base-url for the created client to use when sending requests to Solr.
|
HttpSolrClient.Builder |
withInvariantParams(ModifiableSolrParams params)
Adds to the set of params that the created
HttpSolrClient will add on all requests |
HttpSolrClient.Builder |
withKerberosDelegationToken(String delegationToken)
Use a delegation token for authenticating via the KerberosPlugin
|
withConnectionTimeout, withHttpClient, withResponseParser, withSocketTimeout
protected String baseSolrUrl
protected boolean compression
protected ModifiableSolrParams invariantParams
public Builder()
public Builder(String baseSolrUrl)
SolrClient client = new HttpSolrClient.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 HttpSolrClient.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. By default, compression is not enabled on created HttpSolrClient objects.
public HttpSolrClient.Builder withBaseSolrUrl(String baseSolrUrl)
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.
public HttpSolrClient.Builder allowCompression(boolean compression)
HttpSolrClient
s use compression by default.public HttpSolrClient.Builder withKerberosDelegationToken(String delegationToken)
public HttpSolrClient.Builder withInvariantParams(ModifiableSolrParams params)
HttpSolrClient
will add on all requestsparams
- a set of parameters to add to the invariant-params list. These params must be unique and may not
duplicate a param already in the invariant list.public HttpSolrClient build()
HttpSolrClient
based on provided configuration.public HttpSolrClient.Builder getThis()
SolrClientBuilder
getThis
in class SolrClientBuilder<HttpSolrClient.Builder>
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.