@Override public SolrClient create() throws Exception { // SolrCloud if (args.solrCloud) { List<String> urls = Splitter.on(',').splitToList(args.solrUrl); if (StringUtils.isNotEmpty(args.solrZkChroot)) { return new CloudSolrClient.Builder(urls, Optional.of(args.solrZkChroot)).build(); // Connect to ZooKeeper } else { return new CloudSolrClient.Builder(urls).build(); // Connect to list of Solr servers } } // Standlone return new ConcurrentUpdateSolrClient.Builder(args.solrUrl) .withQueueSize(args.solrBatch) .withThreadCount(args.threads) .build(); }
DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(args[0]))); int docs = reader.maxDoc(); SolrClient solr = new ConcurrentUpdateSolrClient.Builder(args[1]).withQueueSize(2000).withThreadCount(2).build(); Set<SolrInputDocument> batch = new HashSet<SolrInputDocument>(1000);
DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(args[0]))); int docs = reader.maxDoc(); SolrClient solr = new ConcurrentUpdateSolrClient.Builder(args[1]).withQueueSize(10000).withThreadCount(2).build(); Set<SolrInputDocument> batch = new HashSet<SolrInputDocument>(1000);
if (cloudServer == null) { HttpSolrClient solrServer = new HttpSolrClient.Builder(url).build(); ConcurrentUpdateSolrClient solrStreamingServer = new ConcurrentUpdateSolrClient.Builder(url).withQueueSize(streamingQueueSize).withThreadCount(streamingThreadCount).build();
/** * Uses the supplied HttpClient to send documents to the Solr server. * * @deprecated use {@link ConcurrentUpdateSolrClient#ConcurrentUpdateSolrClient(Builder)} instead, as it is a more extension/subclassing-friendly alternative */ @Deprecated protected ConcurrentUpdateSolrClient(String solrServerUrl, HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes) { this((streamDeletes) ? new Builder(solrServerUrl) .withHttpClient(client) .withQueueSize(queueSize) .withThreadCount(threadCount) .withExecutorService(es) .alwaysStreamDeletes() : new Builder(solrServerUrl) .withHttpClient(client) .withQueueSize(queueSize) .withThreadCount(threadCount) .withExecutorService(es) .neverStreamDeletes()); }
public FileLoader(String solrURL) throws MalformedURLException { solr = new ConcurrentUpdateSolrClient.Builder(solrURL).withQueueSize(10000).withThreadCount(2).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.ConcurrentUpdateSolrClient.Builder} class directly */ public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, HttpClient httpClient, int queueSize, int threadCount) { return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl) .withHttpClient(httpClient) .withQueueSize(queueSize) .withThreadCount(threadCount) .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.ConcurrentUpdateSolrClient.Builder} class directly */ public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount, int connectionTimeoutMillis) { return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl) .withQueueSize(queueSize) .withThreadCount(threadCount) .withConnectionTimeout(connectionTimeoutMillis) .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.ConcurrentUpdateSolrClient.Builder} class directly */ public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount) { return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl) .withQueueSize(queueSize) .withThreadCount(threadCount) .build(); }