/** * @deprecated use {@link HttpSolrClient#HttpSolrClient(Builder)} instead, as it is a more extension/subclassing-friendly alternative */ @Deprecated protected HttpSolrClient(String baseURL, HttpClient client, ResponseParser parser, boolean allowCompression) { this(new Builder(baseURL) .withHttpClient(client) .withResponseParser(parser) .allowCompression(allowCompression)); }
public SolrCollectionManager() { // build client to connect to solr SolrFlintConfig config = SolrFlintConfig.getInstance(); // use cloud? Collection<String> zkhosts = config.getZKHosts(); if (zkhosts != null && !zkhosts.isEmpty()) { this.defaultShards = zkhosts.size(); this.defaultReplicas = 1; this._solr = new CloudSolrClient.Builder().withZkHost(zkhosts).build(); } else { this.defaultShards = 1; this.defaultReplicas = 1; this._solr = new HttpSolrClient.Builder(config.getServerURL()).allowCompression(true).build(); } }
/** * The constructor. * * @param baseURL The base url to communicate with the Solr server * @param client Http client instance to use for communication * @param parser Response parser instance to use to decode response from Solr server * @param allowCompression Should compression be allowed ? * @param invariantParams The parameters which should be included with every request. * * @deprecated use {@link HttpSolrClient#HttpSolrClient(Builder)} instead, as it is a more extension/subclassing-friendly alternative */ @Deprecated protected HttpSolrClient(String baseURL, HttpClient client, ResponseParser parser, boolean allowCompression, ModifiableSolrParams invariantParams) { this(new Builder(baseURL) .withHttpClient(client) .withResponseParser(parser) .allowCompression(allowCompression) .withInvariantParams(invariantParams)); }
/** * Creates the datastore. * * @param url The URL of SOLR server * @param layerMapper The document loader. */ public SolrDataStore(URL url, SolrLayerMapper layerMapper) { // TODO: make connection timeouts configurable this.url = url; this.layerMapper = layerMapper; this.solrServer = new HttpSolrClient.Builder() .withBaseSolrUrl(url.toString()) .allowCompression(true) .build(); this.solrServer.setConnectionTimeout(10000); this.solrServer.setFollowRedirects(true); this.solrServer.setSoTimeout(10000); }
public SolrIndexIO(Index index) { this._collection = index.getIndexID(); // build client to connect to solr SolrFlintConfig config = SolrFlintConfig.getInstance(); // use cloud? Collection<String> zkhosts = config.getZKHosts(); if (zkhosts != null && !zkhosts.isEmpty()) { this._client = new CloudSolrClient.Builder().withZkHost(zkhosts).build(); } else { this._client = new HttpSolrClient.Builder(config.getServerURL()).allowCompression(true).build(); } }
public SolrCollectionManager(String url) { this.defaultShards = 1; this.defaultReplicas = 1; this._solr = new HttpSolrClient.Builder(url).allowCompression(true).build(); }
/** * This method <i>may</i> randomize unspecified aspects of the resulting SolrClient. * Tests that do not wish to have any randomized behavior should use the * {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly */ public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, ResponseParser responseParser, boolean compression) { return new Builder(url) .withHttpClient(httpClient) .withResponseParser(responseParser) .allowCompression(compression) .build(); }