Package org.apache.solr.client.solrj.impl

## 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>

Constructs `LBHttpSolrClient` instances from provided configuration.

### Field Summary

Fields
`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
`Builder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`LBHttpSolrClient` `build()` Create a `HttpSolrClient` 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 configuring `LBHttpSolrClient` instances.
`LBHttpSolrClient.Builder` `withBaseSolrUrls​(String... solrUrls)` Provide Solr endpoints to be used when configuring `LBHttpSolrClient` instances.
`LBHttpSolrClient.Builder` `withHttpSolrClientBuilder​(HttpSolrClient.Builder builder)` Provides a `HttpSolrClient.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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### CHECK_INTERVAL

    public static final int CHECK_INTERVAL

See Also:
  Constant Field Values

#### baseSolrUrls

    protected final List<String> baseSolrUrls

#### httpSolrClientBuilder

    protected HttpSolrClient.Builder httpSolrClientBuilder

### Constructor Detail

#### Builder

    public Builder()

### Method Detail

#### getHttpSolrClientBuilder

    public HttpSolrClient.Builder getHttpSolrClientBuilder()

#### withBaseSolrUrl

    public LBHttpSolrClient.Builder withBaseSolrUrl​(String baseSolrUrl)

Provide a Solr endpoint to be used when configuring `LBHttpSolrClient` 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 configuring `LBHttpSolrClient` 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 a `HttpSolrClient.Builder` to be used for building the internally used clients.

#### build

    public LBHttpSolrClient build()

Create a `HttpSolrClient` 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 class `SolrClientBuilder<LBHttpSolrClient.Builder>`