本文整理汇总了Java中org.apache.solr.core.CoreDescriptor.setConfigName方法的典型用法代码示例。如果您正苦于以下问题:Java CoreDescriptor.setConfigName方法的具体用法?Java CoreDescriptor.setConfigName怎么用?Java CoreDescriptor.setConfigName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.CoreDescriptor
的用法示例。
在下文中一共展示了CoreDescriptor.setConfigName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startSolr
import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
* Start up an embedded Solr server.
*
* @param home The path to the Solr home directory
* @return EmbeddedSolrServer: The instantiated server
* @throws Exception if any errors occur
*/
private EmbeddedSolrServer startSolr(String home) throws Exception {
try {
SolrConfig solrConfig = new SolrConfig(home, SOLR_CONFIG, null);
IndexSchema schema = new IndexSchema(solrConfig, SOLR_SCHEMA, null);
solrContainer = new CoreContainer(new SolrResourceLoader(
SolrResourceLoader.locateSolrHome()));
CoreDescriptor descriptor = new CoreDescriptor(solrContainer, "",
solrConfig.getResourceLoader().getInstanceDir());
descriptor.setConfigName(solrConfig.getResourceName());
descriptor.setSchemaName(schema.getResourceName());
solrCore = new SolrCore(null, solrConfig.getDataDir(),
solrConfig, schema, descriptor);
solrContainer.register("cheese", solrCore, false);
// CoreAdminRequest.create
return new EmbeddedSolrServer(solrContainer, "cheese");
} catch(Exception ex) {
log.error("\nFailed to start Solr server\n");
throw ex;
}
}
示例2: buildSolrIndex
import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
private EmbeddedSolrServer buildSolrIndex(String home) throws ParserConfigurationException, IOException, SAXException {
SolrConfig solrConfig = new SolrConfig(home, SOLR_CONFIG, null);
IndexSchema schema = new IndexSchema(solrConfig, SOLR_SCHEMA, null);
solrContainer = new CoreContainer(new SolrResourceLoader(
SolrResourceLoader.locateSolrHome()));
CoreDescriptor descriptor = new CoreDescriptor(solrContainer, "",
solrConfig.getResourceLoader().getInstanceDir());
descriptor.setConfigName(solrConfig.getResourceName());
descriptor.setSchemaName(schema.getResourceName());
SolrCore solrCore = new SolrCore(null, solrConfig.getDataDir(),solrConfig, schema, descriptor);
solrContainer.register("cheese", solrCore, false);
return new EmbeddedSolrServer(solrContainer, "cheese");
}
示例3: initialize
import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
@Override
public CoreContainer initialize() {
CoreContainer container = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateSolrHome())) {
{
hostPort = System.getProperty("hostPort");
hostContext = "solr";
defaultCoreName = CoreContainer.DEFAULT_DEFAULT_CORE_NAME;
initShardHandler(null);
initZooKeeper(System.getProperty("zkHost"), 10000);
}
};
LogWatcher<?> logging = new JulWatcher("test");
logging.registerListener(new ListenerConfig(), container);
container.setLogging(logging);
CoreDescriptor dcore = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstanceDir());
dcore.setConfigName(solrConfig.getResourceName());
dcore.setSchemaName(indexSchema.getResourceName());
SolrCore core = new SolrCore(coreName, dataDirectory, solrConfig, indexSchema, dcore);
container.register(coreName, core, false);
// TODO: we should be exercising the *same* core container initialization code, not equivalent code!
if (container.getZkController() == null && core.getUpdateHandler().getUpdateLog() != null) {
// always kick off recovery if we are in standalone mode.
core.getUpdateHandler().getUpdateLog().recoverFromLog();
}
return container;
}