System.setProperty("solr.hdfs.nrtcachingdirectory", "false");
System.setProperty("solr.hdfs.blockcache.enabled", "false");
System.setProperty("solr.autoCommit.maxTime", "600000");
System.setProperty("solr.autoSoftCommit.maxTime", "-1");
CoreContainer container = new CoreContainer(loader);
container.load();
Properties props = new Properties();
props.setProperty(CoreDescriptor.CORE_DATADIR, dataDirStr);
CoreDescriptor descr = new CoreDescriptor(container, "core1",
solrHomeDir.toString());
descr.setDataDir(dataDirStr);
descr.setCoreProperties(props);
SolrCore core = container.create(descr);
if (!(core.getDirectoryFactory() instanceof HdfsDirectoryFactory)) {
throw new UnsupportedOperationException(
"Invalid configuration. Currently, the only DirectoryFactory supported is "
+ HdfsDirectoryFactory.class.getSimpleName());
}
container.register(core, false);
EmbeddedSolrServer solr = new EmbeddedSolrServer(container, "core1");
return solr;
}