Class LBHttp2SolrClient.Builder
java.lang.Object
org.apache.solr.client.solrj.impl.LBHttp2SolrClient.Builder
- Enclosing class:
LBHttp2SolrClient
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBuilder(Http2SolrClient http2Client, String... baseSolrUrls) Deprecated.Builder(Http2SolrClient http2Client, LBSolrClient.Endpoint... endpoints) Create a Builder object, based on the provided solrClient and endpoint objects. -
Method Summary
Modifier and TypeMethodDescriptionbuild()setAliveCheckInterval(int aliveCheckInterval, TimeUnit unit) LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive.withDefaultCollection(String defaultCoreOrCollection) Sets a default for core or collection based requests.
-
Field Details
-
defaultCollection
-
-
Constructor Details
-
Builder
Deprecated.useBuilder(Http2SolrClient, Endpoint...)insteadCreate a Builder object, based on the provided solrClient and Solr URLs.Two different paths can be specified as a part of the provided URLs:
1) A path pointing directly at a particular core
SolrClient client = new LBHttp2SolrClient.Builder(client, "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. Attempts to make core-agnostic requests, or requests for other cores will fail.Use of these core-based URLs is deprecated and will not be supported in Solr 10.0 Users should instead provide base URLs as described below, and provide a "default collection" as desired using
withDefaultCollection(String)2) The path of the root Solr path ("/solr")
SolrClient client = new LBHttp2SolrClient.Builder(client, "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. Users can still provide a "default" collection if desired through use ofwithDefaultCollection(String). -
Builder
Create a Builder object, based on the provided solrClient and endpoint objects.Endpoint instances come in two main flavors:
1) Endpoints representing a particular core or collection
SolrClient client = new LBHttp2SolrClient.Builder( client, new LBSolrClient.Endpoint("http://my-solr-server:8983/solr", "core1")) .build(); QueryResponse resp = client.query(new SolrQuery("*:*"));Note that when a core is provided in the endpoint, queries and other requests can be made without mentioning the core explicitly. However, the client can only send requests to that core. Attempts to make core-agnostic requests, or requests for other cores will fail.2) Endpoints representing the root Solr path (i.e. "/solr")
SolrClient client = new LBHttp2SolrClient.Builder( client, new LBSolrClient.Endpoint("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. Users can still provide a "default" collection if desired through use ofwithDefaultCollection(String).
-
-
Method Details
-
setAliveCheckInterval
LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive. Use this to set that interval- Parameters:
aliveCheckInterval- how often to ping for aliveness
-
withDefaultCollection
Sets a default for core or collection based requests.This method should not be used if the client is provided a Solr URL which already contains a core or collection name.
-
build
-
Builder(Http2SolrClient, Endpoint...)instead