List of usage examples for org.apache.solr.servlet DirectSolrConnection DirectSolrConnection
public DirectSolrConnection(SolrCore c)
From source file:com.sindicetech.siren.solr.handler.TestSirenUpdateRequestHandler.java
License:Open Source License
private String sendUpdateRequest(String input) { try (SolrCore core = h.getCoreInc()) { DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler(HANDLER_NAME); return connection.request(handler, null, input); } catch (SolrException e) { throw e;/*from w ww . j av a2s.c o m*/ } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } }
From source file:org.vootoo.schema.CrossCoreFieldTest.java
License:Apache License
public String update(String coreName, String xml) { try (SolrCore core = coreContainer.getCore(coreName)) { DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler("/update"); // prefer the handler mapped to /update, but use our generic backup handler // if that lookup fails if (handler == null) { throw new Exception("not found update handler"); }/* w ww . ja v a 2 s . c om*/ return connection.request(handler, null, xml); } catch (SolrException e) { throw (SolrException) e; } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } }