Class SolrClientHelper
java.lang.Object
org.apache.tika.pipes.plugin.solr.SolrClientHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyClientSettings(org.apache.solr.client.solrj.jetty.HttpJettySolrClient.Builder builder, HttpClientFactory factory) Applies authentication, proxy and SSL settings fromfactoryto aHttpJettySolrClient.Builder.static org.apache.solr.client.solrj.SolrClientbuildLbClient(org.apache.solr.client.solrj.jetty.HttpJettySolrClient.Builder builder, List<String> solrUrls) Builds a direct-URL (load-balanced) Solr client from a configured builder and the list of base Solr URLs.
-
Method Details
-
applyClientSettings
public static void applyClientSettings(org.apache.solr.client.solrj.jetty.HttpJettySolrClient.Builder builder, HttpClientFactory factory) throws TikaConfigException Applies authentication, proxy and SSL settings fromfactoryto aHttpJettySolrClient.Builder.- Auth: when a username is configured, only the basic scheme is supported; any other
scheme throws
TikaConfigException. When no username is set, auth is skipped regardless of the configured scheme (matching the original Http2SolrClient code). - Proxy: configured only when both a non-blank host and a positive port are present.
- SSL: verified by default. When
factory.isVerifySsl()is false, all certificates are trusted and hostname verification is disabled (opt-in; preserves the pre-Jetty-12 HttpClientFactory behaviour for self-signed Solr endpoints).
- Throws:
TikaConfigException
- Auth: when a username is configured, only the basic scheme is supported; any other
scheme throws
-
buildLbClient
public static org.apache.solr.client.solrj.SolrClient buildLbClient(org.apache.solr.client.solrj.jetty.HttpJettySolrClient.Builder builder, List<String> solrUrls) Builds a direct-URL (load-balanced) Solr client from a configured builder and the list of base Solr URLs.The returned client closes the underlying
HttpJettySolrClientwhen it is closed. The stockLBJettySolrClientdoes not own its delegate client (seeLBSolrClient.close()), so without this the Jetty thread pool and selectors created by the delegate would leak every time a caller closes the load-balanced client.
-