(String solrUrl, String credentials, boolean barePath)
| 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. |
no test coverage detected