List of usage examples for org.apache.solr.client.solrj.impl HttpSolrClient getBaseURL
public String getBaseURL()
From source file:com.frank.search.solr.server.support.HttpSolrClientFactory.java
License:Apache License
protected void appendCoreToBaseUrl(String core, SolrClient solrClient) { if (StringUtils.isNotEmpty(core) && isHttpSolrClient(solrClient)) { HttpSolrClient httpSolrClient = (HttpSolrClient) solrClient; String url = SolrClientUtils.appendCoreToBaseUrl(httpSolrClient.getBaseURL(), core); httpSolrClient.setBaseURL(url);/* w w w. j av a2s .com*/ } }
From source file:org.broadleafcommerce.core.search.service.solr.SolrConfiguration.java
License:Open Source License
protected String determineCoreName(HttpSolrClient httpSolrClient) { String url = httpSolrClient.getBaseURL(); String coreName = url.substring(url.lastIndexOf('/') + 1); return coreName; }
From source file:org.mousephenotype.cda.solr.SolrUtils.java
License:Apache License
/** * Extract the SOLR base URL from the <code>SolrClient</code> instance * * @param solrClient the <code>SolrClient</code> instance * @return the SOLR server base URL, if it can be found; or an empty string * if it cannot./* www .j a v a2s . co m*/ */ public static String getBaseURL(SolrClient solrClient) { HttpSolrClient httpSolrClient = (solrClient instanceof HttpSolrClient ? (HttpSolrClient) solrClient : getHttpSolrServer(solrClient)); if (httpSolrClient != null) { return httpSolrClient.getBaseURL(); } return ""; }
From source file:org.springframework.data.solr.server.support.SolrClientUtilTests.java
License:Apache License
@Test public void testClonesHttpSolrClientCorrectly() { HttpSolrClient httpSolrClient = new HttpSolrClient(BASE_URL); httpSolrClient.setDefaultMaxConnectionsPerHost(10); httpSolrClient.setFollowRedirects(true); httpSolrClient.setUseMultiPartPost(true); HttpSolrClient clone = SolrClientUtils.clone(httpSolrClient); Assert.assertEquals(httpSolrClient.getBaseURL(), clone.getBaseURL()); assertHttpSolrClientProperties(httpSolrClient, clone); }
From source file:org.springframework.data.solr.server.support.SolrClientUtilTests.java
License:Apache License
@Test public void testClonesHttpSolrClientForCoreCorrectly() { HttpSolrClient httpSolrClient = new HttpSolrClient(BASE_URL); httpSolrClient.setDefaultMaxConnectionsPerHost(10); httpSolrClient.setFollowRedirects(true); httpSolrClient.setUseMultiPartPost(true); HttpSolrClient clone = SolrClientUtils.clone(httpSolrClient, CORE_NAME); Assert.assertEquals(CORE_URL, clone.getBaseURL()); assertHttpSolrClientProperties(httpSolrClient, clone); }