MCPcopy Create free account
hub / github.com/apache/solr / getSolrClient

Method getSolrClient

solr/core/src/java/org/apache/solr/cli/CLIUtils.java:137–153  ·  view source on GitHub ↗
(String solrUrl, String credentials, boolean barePath)

Source from the content-addressed store, hash-verified

135 }
136
137 public static SolrClient getSolrClient(String solrUrl, String credentials, boolean barePath) {
138 // today we require all urls to end in /solr, however in the future we will need to support the
139 // /api url end point instead. Eventually we want to have this method always
140 // return a bare url, and then individual calls decide if they are /solr or /api
141 // The /solr/ check is because sometimes a full url is passed in, like
142 // http://localhost:8983/solr/films_shard1_replica_n1/.
143 if (!barePath && !solrUrl.endsWith("/solr") && !solrUrl.contains("/solr/")) {
144 solrUrl = solrUrl + "/solr";
145 }
146 var builder =
147 new HttpJettySolrClient.Builder(solrUrl)
148 .withMaxConnectionsPerHost(32)
149 .withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
150 .withOptionalBasicAuthCredentials(credentials);
151
152 return builder.build();
153 }
154
155 /**
156 * Helper method for all the places where we assume a /solr on the url.

Callers 15

runImplMethod · 0.95
runCloudToolMethod · 0.95
commitMethod · 0.95
optimizeMethod · 0.95
assertSolrNotRunningMethod · 0.95
runningSolrIsCloudMethod · 0.95
callGetMethod · 0.95
runImplMethod · 0.95
runImplMethod · 0.95
runImplMethod · 0.95
runImplMethod · 0.95
runImplMethod · 0.95

Calls 6

normalizeSolrUrlMethod · 0.95
buildMethod · 0.65
containsMethod · 0.45

Tested by

no test coverage detected