当前位置: 首页>>代码示例>>Java>>正文


Java CoreDescriptor.setConfigName方法代码示例

本文整理汇总了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;
        }
    }
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:GeonamesIndexGenerator.java

示例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");
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:16,代码来源:GeonamesIndex.java

示例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;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:29,代码来源:TestHarness.java


注:本文中的org.apache.solr.core.CoreDescriptor.setConfigName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。