Example usage for org.apache.solr.servlet DirectSolrConnection request

List of usage examples for org.apache.solr.servlet DirectSolrConnection request

Introduction

In this page you can find the example usage for org.apache.solr.servlet DirectSolrConnection request.

Prototype

public String request(SolrRequestHandler handler, SolrParams params, String body) throws Exception 

Source Link

Usage

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;//  w w  w  . j  a  va 2s .co  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");
        }//from ww  w  . jav  a2 s .  c o m
        return connection.request(handler, null, xml);
    } catch (SolrException e) {
        throw (SolrException) e;
    } catch (Exception e) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
    }
}