use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.
the class TestInitParams method testMultiInitParams.
@Test
public void testMultiInitParams() {
SolrRequestHandler handler = h.getCore().getRequestHandler("/dump6");
SolrQueryResponse rsp = new SolrQueryResponse();
handler.handleRequest(req("initArgs", "true"), rsp);
NamedList nl = (NamedList) rsp.getValues().get("initArgs");
NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
assertEquals("A", def.get("a"));
assertEquals("P", def.get("p"));
def = (NamedList) nl.get(PluginInfo.INVARIANTS);
assertEquals("B", def.get("b"));
def = (NamedList) nl.get(PluginInfo.APPENDS);
assertEquals("C", def.get("c"));
}
use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.
the class TestInitParams method testComponentWithConflictingInitParams.
@Test
public void testComponentWithConflictingInitParams() {
SolrRequestHandler handler = h.getCore().getRequestHandler("/dump2");
SolrQueryResponse rsp = new SolrQueryResponse();
handler.handleRequest(req("initArgs", "true"), rsp);
NamedList nl = (NamedList) rsp.getValues().get("initArgs");
NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
assertEquals("A1", def.get("a"));
def = (NamedList) nl.get(PluginInfo.INVARIANTS);
assertEquals("B1", def.get("b"));
def = (NamedList) nl.get(PluginInfo.APPENDS);
assertEquals(Arrays.asList("C1", "C"), def.getAll("c"));
}
use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.
the class TestManagedSchema method assertSchemaResource.
private void assertSchemaResource(String collection, String expectedSchemaResource) throws Exception {
final CoreContainer cores = h.getCoreContainer();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
SolrQueryRequest request = req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
SolrQueryResponse response = new SolrQueryResponse();
admin.handleRequestBody(request, response);
assertNull("Exception on create", response.getException());
NamedList responseValues = response.getValues();
NamedList status = (NamedList) responseValues.get("status");
NamedList collectionStatus = (NamedList) status.get(collection);
String collectionSchema = (String) collectionStatus.get(CoreAdminParams.SCHEMA);
assertEquals("Schema resource name differs from expected name", expectedSchemaResource, collectionSchema);
}
use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.
the class TestManagedSchema method testDefaultSchemaFactory.
public void testDefaultSchemaFactory() throws Exception {
deleteCore();
initCore("solrconfig-managed-schema-test.xml", "schema-minimal.xml", tmpSolrHome.getPath());
final CoreContainer cores = h.getCoreContainer();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
SolrQueryRequest request = req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
SolrQueryResponse response = new SolrQueryResponse();
admin.handleRequestBody(request, response);
assertNull("Exception on create", response.getException());
assertSchemaResource(collection, "managed-schema");
}
use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.
the class TestSearchPerf method createIndex2.
// Skip encoding for updating the index
void createIndex2(int nDocs, String... fields) throws IOException {
Set<String> fieldSet = new HashSet<>(Arrays.asList(fields));
SolrQueryRequest req = lrf.makeRequest();
SolrQueryResponse rsp = new SolrQueryResponse();
UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessingChain(null);
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
boolean foomany_s = fieldSet.contains("foomany_s");
boolean foo1_s = fieldSet.contains("foo1_s");
boolean foo2_s = fieldSet.contains("foo2_s");
boolean foo4_s = fieldSet.contains("foo4_s");
boolean foo8_s = fieldSet.contains("foo8_s");
boolean t10_100_ws = fieldSet.contains("t10_100_ws");
for (int i = 0; i < nDocs; i++) {
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", Float.toString(i));
if (foomany_s) {
doc.addField("foomany_s", t(r.nextInt(nDocs * 10)));
}
if (foo1_s) {
doc.addField("foo1_s", t(0));
}
if (foo2_s) {
doc.addField("foo2_s", r.nextInt(2));
}
if (foo4_s) {
doc.addField("foo4_s", r.nextInt(4));
}
if (foo8_s) {
doc.addField("foo8_s", r.nextInt(8));
}
if (t10_100_ws) {
StringBuilder sb = new StringBuilder(9 * 100);
for (int j = 0; j < 100; j++) {
sb.append(' ');
sb.append(t(r.nextInt(10)));
}
doc.addField("t10_100_ws", sb.toString());
}
AddUpdateCommand cmd = new AddUpdateCommand(req);
cmd.solrDoc = doc;
processor.processAdd(cmd);
}
processor.finish();
processor.close();
req.close();
assertU(commit());
req = lrf.makeRequest();
assertEquals(nDocs, req.getSearcher().maxDoc());
req.close();
}
Aggregations