@Override public void connect() throws IOException { if (httpClient == null && executorService == null) { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, queueSize, threadCount); } else if (executorService == null) { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, httpClient, queueSize, threadCount); } else { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, httpClient, queueSize, threadCount, executorService, streamDeletes); } }
@Override public void blockUntilFinished() { super.blockUntilFinished(); synchronized (myLock) { if (currentException != null) { throw new RuntimeException(currentException); } } }
queryEngine.setMaxRetries(1); updateEngine = new ConcurrentUpdateSolrServer(solrServerUrlString, 100, 1); updateEngine.setConnectionTimeout(10000); updateEngine.setPollQueueTime(25);
@Override public void deleteByQuery(String query) throws SearchEngineException { try { updateEngine.deleteByQuery(query, 100); } catch (SolrServerException | IOException e) { throw appropriateException( "Solr server failed to delete documents: " + query, e); } }
@Override public void deleteById(Collection<String> ids) throws SearchEngineException { try { updateEngine.deleteById(new ArrayList<>(ids), 100); } catch (SolrServerException | IOException e) { throw appropriateException( "Solr server failed to delete documents: " + ids, e); } }
@Override public void add(Collection<SearchInputDocument> docs) throws SearchEngineException { try { updateEngine.add(SolrConversionUtils.convertToSolrInputDocuments(docs), 100); } catch (SolrServerException | IOException e) { throw appropriateException("Solr server failed to add documents " + docs, e); } }
@Override public void connect() throws IOException { if (httpClient == null && executorService == null) { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, queueSize, threadCount); } else if (executorService == null) { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, httpClient, queueSize, threadCount); } else { solrServer = new ConcurrentUpdateSolrServer(solrServerURL, httpClient, queueSize, threadCount, executorService, streamDeletes); } }
@Override public void blockUntilFinished() { super.blockUntilFinished(); synchronized (myLock) { if (currentException != null) { throw new RuntimeException(currentException); } } }
@Nullable @Override public SolrClient getIndexingSolrServer() throws Exception { if (indexingSolrServer == null) { indexingSolrServer = new ConcurrentUpdateSolrServer(getUrl(), 1000, 4); } return indexingSolrServer; }
@Override public void commitTransaction() throws SolrServerException, IOException { LOGGER.trace("commitTransaction"); if (batch.size() > 0) { sendBatch(); } if (numSentItems > 0) { if (server instanceof ConcurrentUpdateSolrServer) { ((ConcurrentUpdateSolrServer) server).blockUntilFinished(); } } }
public ConcurrentUpdateSolrServer getStreamingSolrServer(String coreName) { try { return new ConcurrentUpdateSolrServer(getSolrUrl(coreName).toString(), 4, 4); } catch (MalformedURLException e) { throw new IllegalStateException("URL should be well formed", e); } } }
@Override public void commitTransaction() throws SolrServerException, IOException { LOGGER.trace("commitTransaction"); if (batch.size() > 0) { loadBatch(); } if (numLoadedDocs > 0) { if (server instanceof ConcurrentUpdateSolrServer) { ((ConcurrentUpdateSolrServer) server).blockUntilFinished(); } } }
@Nullable @Override public SolrClient getIndexingSolrServer() throws Exception { if (indexingSolrServer == null) { indexingSolrServer = new ConcurrentUpdateSolrServer(getUrl(), 1000, 4); } return indexingSolrServer; }
/** * Instantiates a new embedded index. * * @param solrHomePath * the solr home path * @param coreName * the core name * */ public SolrRemoteIndex(final String solrUrl, final String replicaMasterUrl, final String coreName) { baseUrl = solrUrl + (solrUrl.endsWith("/") ? StringUtils.EMPTY : "/") + coreName; if(StringUtils.isNotEmpty(replicaMasterUrl)){ this.replicaMasterUrl = replicaMasterUrl + (replicaMasterUrl.endsWith("/") ? StringUtils.EMPTY : "/") + coreName; } else { this.replicaMasterUrl = baseUrl; } updateServer = new ConcurrentUpdateSolrServer(this.replicaMasterUrl, QUEUE_SIZE, CONCURRENT_THREADS); searchServer = new HttpSolrServer(this.baseUrl); }
SolrServer solr = new ConcurrentUpdateSolrServer(serverUrl, batchSize, 1);
public void runExample(ExampleDriver driver) throws Exception { String serverUrl = driver.getCommandLine().getOptionValue("solr", ExampleDriver.DEFAULT_SOLR_URL); SolrServer solr = new ConcurrentUpdateSolrServer(serverUrl, 1000, 2);