/** * Note: This setter method is <b>not thread-safe</b>. * * @param processor * Default Response Parser chosen to parse the response if the parser * were not specified as part of the request. * @see org.apache.solr.client.solrj.SolrRequest#getResponseParser() */ public void setParser(ResponseParser processor) { lbClient.setParser(processor); }
/** * Note: This setter method is <b>not thread-safe</b>. * * @param processor * Default Response Parser chosen to parse the response if the parser * were not specified as part of the request. * @see org.apache.solr.client.solrj.SolrRequest#getResponseParser() */ public void setParser(ResponseParser processor) { lbClient.setParser(processor); }
private SolrClient getStandaloneQuerySolrClient() { LBHttpSolrClient lbHttpSolrClient = null; try { if (StringUtils.isEmpty(solrSlaves) && StringUtils.isNotEmpty(solrMaster)) { LOG.debug("Creating LBHttpSolrClient using solrMaster {}", solrMaster); lbHttpSolrClient = new LBHttpSolrClient(solrMaster); } else if (StringUtils.isNotEmpty(solrSlaves)) { LOG.debug("Creating LBHttpSolrClient using solrSlaves {}", solrSlaves); lbHttpSolrClient = new LBHttpSolrClient(solrSlaves); if (solrAllowMasterQueriesEnabled && StringUtils.isNotEmpty(solrMaster)) { LOG.debug("Adding solrMaster {} to the LBHttpSolrClient", solrSlaves); lbHttpSolrClient.addSolrServer(solrMaster); } } else if (StringUtils.isEmpty(solrSlaves) && StringUtils.isEmpty(solrMaster)) { // unexpected throw new AEMSolrSearchException("Initialization failed. " + "Either 'solr.master' or 'solr.slaves' properties are missing for Standalone mode."); } else { // Do nothing } } catch (MalformedURLException e) { LOG.error("Error for malformed URL.", e); } catch (AEMSolrSearchException e) { LOG.error("Solr client initialization failed.", e); } lbHttpSolrClient.setParser(new XMLResponseParser()); return lbHttpSolrClient; }
this.lbClient = new LBHttpSolrClient(myClient); this.lbClient.setRequestWriter(new BinaryRequestWriter()); this.lbClient.setParser(new BinaryResponseParser()); this.updatesToLeaders = true; shutdownLBHttpSolrServer = true;
/** * @param zkHost * A zookeeper client endpoint. * @param updatesToLeaders * If true, sends updates only to shard leaders. * @param httpClient * the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a * multi-threaded connection manager. * @see #CloudSolrClient(String) for full description and details on zkHost */ public CloudSolrClient(String zkHost, boolean updatesToLeaders, HttpClient httpClient) { this.zkHost = zkHost; this.clientIsInternal = httpClient == null; this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient; this.lbClient = new LBHttpSolrClient(myClient); this.lbClient.setRequestWriter(new BinaryRequestWriter()); this.lbClient.setParser(new BinaryResponseParser()); this.updatesToLeaders = updatesToLeaders; shutdownLBHttpSolrServer = true; lbClient.addQueryParams(STATE_VERSION); }
private static LBHttpSolrClient createLBHttpSolrClient(Builder cloudSolrClientBuilder, HttpClient httpClient) { final LBHttpSolrClient.Builder lbBuilder = new LBHttpSolrClient.Builder(); lbBuilder.withHttpClient(httpClient); if (cloudSolrClientBuilder.connectionTimeoutMillis != null) { lbBuilder.withConnectionTimeout(cloudSolrClientBuilder.connectionTimeoutMillis); } if (cloudSolrClientBuilder.socketTimeoutMillis != null) { lbBuilder.withSocketTimeout(cloudSolrClientBuilder.socketTimeoutMillis); } final LBHttpSolrClient lbClient = lbBuilder.build(); lbClient.setRequestWriter(new BinaryRequestWriter()); lbClient.setParser(new BinaryResponseParser()); return lbClient; }
this.lbClient = new LBHttpSolrClient(myClient); this.lbClient.setRequestWriter(new BinaryRequestWriter()); this.lbClient.setParser(new BinaryResponseParser()); this.updatesToLeaders = true; shutdownLBHttpSolrServer = true;
this.lbClient = new LBHttpSolrClient(myClient); this.lbClient.setRequestWriter(new BinaryRequestWriter()); this.lbClient.setParser(new BinaryResponseParser()); this.updatesToLeaders = true; shutdownLBHttpSolrServer = true;