use of org.apache.solr.handler.loader.CSVLoader in project lucene-solr by apache.
the class UpdateRequestHandler method createDefaultLoaders.
protected Map<String, ContentStreamLoader> createDefaultLoaders(NamedList args) {
SolrParams p = null;
if (args != null) {
p = SolrParams.toSolrParams(args);
}
Map<String, ContentStreamLoader> registry = new HashMap<>();
registry.put("application/xml", new XMLLoader().init(p));
registry.put("application/json", new JsonLoader().init(p));
registry.put("application/csv", new CSVLoader().init(p));
registry.put("application/javabin", new JavabinLoader().init(p));
registry.put("text/csv", registry.get("application/csv"));
registry.put("text/xml", registry.get("application/xml"));
registry.put("text/json", registry.get("application/json"));
pathVsLoaders.put(JSON_PATH, registry.get("application/json"));
pathVsLoaders.put(DOC_PATH, registry.get("application/json"));
pathVsLoaders.put(CSV_PATH, registry.get("application/csv"));
pathVsLoaders.put(BIN_PATH, registry.get("application/javabin"));
return registry;
}
use of org.apache.solr.handler.loader.CSVLoader in project lucene-solr by apache.
the class CSVRequestHandlerTest method testCommitWithin.
@Test
public void testCommitWithin() throws Exception {
String csvString = "id;name\n123;hello";
SolrQueryRequest req = req("separator", ";", "commitWithin", "200");
SolrQueryResponse rsp = new SolrQueryResponse();
BufferingRequestProcessor p = new BufferingRequestProcessor(null);
CSVLoader loader = new CSVLoader();
loader.load(req, rsp, new ContentStreamBase.StringStream.StringStream(csvString), p);
AddUpdateCommand add = p.addCommands.get(0);
assertEquals(200, add.commitWithin);
req.close();
}
use of org.apache.solr.handler.loader.CSVLoader in project lucene-solr by apache.
the class MetricsCollectorHandler method init.
@Override
public void init(NamedList initArgs) {
super.init(initArgs);
if (initArgs != null) {
params = SolrParams.toSolrParams(initArgs);
} else {
params = new ModifiableSolrParams();
}
loaders.put("application/xml", new XMLLoader().init(params));
loaders.put("application/json", new JsonLoader().init(params));
loaders.put("application/csv", new CSVLoader().init(params));
loaders.put("application/javabin", new JavabinLoader().init(params));
loaders.put("text/csv", loaders.get("application/csv"));
loaders.put("text/xml", loaders.get("application/xml"));
loaders.put("text/json", loaders.get("application/json"));
}
Aggregations