/** * @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)); }
.withResponseParser(new XMLResponseParser()) .build(); log.info("using XMLResponseParser");
/** * 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)); }
final HttpSolrClient.Builder clientBuilder = new HttpSolrClient.Builder(server) .withHttpClient(httpClient) .withResponseParser(parser); if (connectionTimeout != null) { clientBuilder.withConnectionTimeout(connectionTimeout);
public SimpleSolrResponse invoke(String solrNode, String path, SolrParams params) throws IOException, SolrServerException { String url = zkClientClusterStateProvider.getZkStateReader().getBaseUrlForNodeName(solrNode); GenericSolrRequest request = new GenericSolrRequest(SolrRequest.METHOD.POST, path, params); try (HttpSolrClient client = new HttpSolrClient.Builder() .withHttpClient(solrClient.getHttpClient()) .withBaseSolrUrl(url) .withResponseParser(new BinaryResponseParser()) .build()) { NamedList<Object> rsp = client.request(request); request.response.nl = rsp; return request.response; } }
/** * 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) { return new Builder(url) .withHttpClient(httpClient) .withResponseParser(responseParser) .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(); }