Class HttpSolrClient.Builder
- java.lang.Object
- 
- org.apache.solr.client.solrj.impl.SolrClientBuilder<HttpSolrClient.Builder>
- 
- org.apache.solr.client.solrj.impl.HttpSolrClient.Builder
 
 
- 
- Enclosing class:
- HttpSolrClient
 
 public static class HttpSolrClient.Builder extends SolrClientBuilder<HttpSolrClient.Builder> ConstructsHttpSolrClientinstances from provided configuration.
- 
- 
Field SummaryFields Modifier and Type Field Description protected StringbaseSolrUrlprotected booleancompressionprotected ModifiableSolrParamsinvariantParams- 
Fields inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilderconnectionTimeoutMillis, httpClient, responseParser, socketTimeoutMillis
 
- 
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpSolrClient.BuilderallowCompression(boolean compression)Chooses whether createdHttpSolrClients use compression by default.HttpSolrClientbuild()Create aHttpSolrClientbased on provided configuration.HttpSolrClient.BuildergetThis()The solution for the unchecked cast warning.HttpSolrClient.BuilderwithBaseSolrUrl(String baseSolrUrl)Specify the base-url for the created client to use when sending requests to Solr.HttpSolrClient.BuilderwithInvariantParams(ModifiableSolrParams params)Adds to the set of params that the createdHttpSolrClientwill add on all requestsHttpSolrClient.BuilderwithKerberosDelegationToken(String delegationToken)Use a delegation token for authenticating via the KerberosPlugin- 
Methods inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilderwithConnectionTimeout, withHttpClient, withResponseParser, withSocketTimeout
 
- 
 
- 
- 
- 
Field Detail- 
baseSolrUrlprotected String baseSolrUrl 
 - 
compressionprotected boolean compression 
 - 
invariantParamsprotected ModifiableSolrParams invariantParams 
 
- 
 - 
Constructor Detail- 
Builderpublic Builder() 
 - 
Builderpublic Builder(String baseSolrUrl) Create a Builder object, based on the provided Solr URL. Two different paths can be specified as a part of this URL: 1) A path pointing directly at a particular coreSolrClient 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.
 
- 
 - 
Method Detail- 
withBaseSolrUrlpublic HttpSolrClient.Builder withBaseSolrUrl(String baseSolrUrl) Specify the base-url for the created client to use when sending requests to Solr. Two different paths can be specified as a part of this URL: 1) A path pointing directly at a particular coreSolrClient 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.
 - 
allowCompressionpublic HttpSolrClient.Builder allowCompression(boolean compression) Chooses whether createdHttpSolrClients use compression by default.
 - 
withKerberosDelegationTokenpublic HttpSolrClient.Builder withKerberosDelegationToken(String delegationToken) Use a delegation token for authenticating via the KerberosPlugin
 - 
withInvariantParamspublic HttpSolrClient.Builder withInvariantParams(ModifiableSolrParams params) Adds to the set of params that the createdHttpSolrClientwill add on all requests- Parameters:
- params- 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.
 
 - 
buildpublic HttpSolrClient build() Create aHttpSolrClientbased on provided configuration.
 - 
getThispublic HttpSolrClient.Builder getThis() Description copied from class:SolrClientBuilderThe solution for the unchecked cast warning.- Specified by:
- getThisin class- SolrClientBuilder<HttpSolrClient.Builder>
 
 
- 
 
-