@Override public void connect() { solrServer = new HttpSolrServer(solrServerURL); }
public static SolrServer getSolrUpdateServer(String solrServerUrl, String coreTmpName) { String indexCoreTmpUrl = solrServerUrl + coreTmpName; return new HttpSolrServer(indexCoreTmpUrl); }
private SolrServer createSolrServer(String url) throws Exception { SolrServer server = new HttpSolrServer(url); // server.ping(); return server; }
@Override public void connect() { solrServer = new HttpSolrServer(solrServerURL); }
@Nullable @Override public SolrClient getSolrServer() throws Exception { if (solrServer == null) { solrServer = new HttpSolrServer(getUrl()); } return solrServer; }
@Nullable @Override public SolrClient getSolrServer() throws Exception { if (solrServer == null) { solrServer = new HttpSolrServer(getUrl()); } return solrServer; }
public static void main(String[] args) throws SolrServerException { ThothServers thothServers = new ThothServers(); ArrayList<ServerDetail> serverDetails = thothServers.getList(new HttpSolrServer("http://thoth.sv2.trulia.com:8983/solr/collection1")); System.out.println(serverDetails.size()); } }
private HttpSolrServer createSolrServer() { HttpSolrServer ontologiesSolrServer = new HttpSolrServer(ontologiesSolrUrl, createHttpClient()); ontologiesSolrServer.setAllowCompression(allowCompression); return ontologiesSolrServer; }
private HttpSolrServer createSolrServer() { HttpSolrServer ontologiesSolrServer = new HttpSolrServer(ontologiesSolrUrl, createHttpClient()); ontologiesSolrServer.setAllowCompression(true); return ontologiesSolrServer; }
SolrServer solrServer; String url = "http://localhost:8080/solr"; solrServer = new HttpSolrServer(url); solrServer.deleteByQuery("*:*"); solrServer.commit();
/** * Remove all documents from the Solr index with the given URL, then commit and optimise the index. * * @param solrUrl URL of the Solr core to clear. * @throws IOException if there is a problem in communicating with Solr. * @throws SolrServerException if there is a problem in communicating with Solr. */ public static void clearIndex(String solrUrl) throws IOException, SolrServerException { HttpSolrServer solr = new HttpSolrServer(solrUrl); solr.deleteByQuery("*:*"); solr.commit(); solr.optimize(); }
String textToSearchFor = "someText"; HttpSolrServer solrServer = new HttpSolrServer("http://localhost:8983/solr"); SolrQuery query = new SolrQuery(); query.setQuery(textToSearchFor); QueryResponse rsp = solrServer.query( query );
protected HttpSolrServer getSolr() throws MalformedURLException, SolrServerException { if (solr == null) { String solrService = ConfigurationManager.getProperty("solr.authority.server"); log.debug("Solr authority URL: " + solrService); solr = new HttpSolrServer(solrService); solr.setBaseURL(solrService); SolrQuery solrQuery = new SolrQuery().setQuery("*:*"); solr.query(solrQuery); } return solr; }
SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr"); ModifiableSolrParams params = new ModifiableSolrParams(); params.set("qt", "/dataimport"); params.set("command", "full-import"); QueryResponse response = solrServer.query(params);
private SolrServer getSolr(final String url) { PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(); mgr.setDefaultMaxPerRoute(20); mgr.setDefaultMaxPerRoute(100); DefaultHttpClient client = new DefaultHttpClient(mgr); HttpParams params = client.getParams(); HttpConnectionParams.setStaleCheckingEnabled(params, true); HttpConnectionParams.setSoTimeout(params, TIMEOUT_MILLISECONDS); client.setHttpRequestRetryHandler(new StandardHttpRequestRetryHandler(3, true)); return new HttpSolrServer(url, client); }
HttpSolrServer httpSolrServer = new HttpSolrServer("http://localhost:8983/solr/collectionname/"); QueryResponse response = httpSolrServer.query(new SolrQuery(), METHOD.POST); SolrDocumentList solrDocumentList = queryResponse.getResults(); solrDocumentList.getNumFound(); solrDocumentList.getStart();
SolrServer server = new HttpSolrServer("http://localhost:8983/solr/CORE_NAME/"); SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", "1"); doc.addField("Name", "John"); doc.addField("RollNo", "101"); server.add(doc); UpdateResponse updateResponse = server.commit(); System.out.println(updateResponse.getStatus());
public SolrJSupport(String hostname, int solrPort, String core) { server = new HttpSolrServer(String.format("http://%s:%d/solr/%s", hostname, solrPort, core)); server.setMaxRetries(1); server.setConnectionTimeout(5000); server.setSoTimeout(5000); }
String urlString = "http://localhost:8983/solr"; SolrServer solr = new HttpSolrServer(urlString); SolrInputDocument document = new SolrInputDocument(); document.addField("id", "552199"); document.addField("name", "Gouda cheese wheel"); document.addField("price", "49.99"); UpdateResponse response = solr.add(document); // Remember to commit your changes! solr.commit();
@Override public void initialize() throws InitializationException { try { this.server = new HttpSolrServer("http://localhost:8080/solr/" + this.getName() + "/"); this.cache = this.cacheFactory.createNewLocalCache(new CacheConfiguration()); } catch (RuntimeException ex) { throw new InitializationException("Invalid URL specified for the Solr server: {}"); } catch (final CacheException ex) { throw new InitializationException("Cannot create cache: " + ex.getMessage()); } }