use of org.apache.solr.servlet.DirectSolrConnection in project lucene-solr by apache.
the class SolrTestCaseJ4 method updateJ.
/** Send JSON update commands */
public static String updateJ(String json, SolrParams args) throws Exception {
SolrCore core = h.getCore();
if (args == null) {
args = params("wt", "json", "indent", "true");
} else {
ModifiableSolrParams newArgs = new ModifiableSolrParams(args);
if (newArgs.get("wt") == null)
newArgs.set("wt", "json");
if (newArgs.get("indent") == null)
newArgs.set("indent", "true");
args = newArgs;
}
DirectSolrConnection connection = new DirectSolrConnection(core);
SolrRequestHandler handler = core.getRequestHandler("/update/json");
if (handler == null) {
handler = new UpdateRequestHandler();
handler.init(null);
}
return connection.request(handler, args, json);
}
use of org.apache.solr.servlet.DirectSolrConnection in project lucene-solr by apache.
the class TestIndexSearcher method addDummyDoc.
private void addDummyDoc(SolrCore core) throws Exception {
DirectSolrConnection connection = new DirectSolrConnection(core);
SolrRequestHandler handler = core.getRequestHandler("/update");
connection.request(handler, null, adoc("id", "1"));
}
use of org.apache.solr.servlet.DirectSolrConnection in project lucene-solr by apache.
the class TestIndexSearcher method doQuery.
private void doQuery(SolrCore core) throws Exception {
DirectSolrConnection connection = new DirectSolrConnection(core);
ModifiableSolrParams params = new ModifiableSolrParams();
params.add("q", "*:*");
assertTrue(connection.request("/select", params, null).contains("<int name=\"status\">0</int>"));
}
Aggregations