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


Java CoreContainer.load方法代码示例

本文整理汇总了Java中org.apache.solr.core.CoreContainer.load方法的典型用法代码示例。如果您正苦于以下问题:Java CoreContainer.load方法的具体用法?Java CoreContainer.load怎么用?Java CoreContainer.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.core.CoreContainer的用法示例。


在下文中一共展示了CoreContainer.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
/**
 *
 * @param solrHome
 *              path to directory where solr.xml lives
 *
 * @param coreName
 *              the name of the core to load
 * @param dataDir
 *              the data dir for the core
 *
 * @return an EmbeddedSolrServer for the given core
 */
public static SolrClient create(String solrHome, String coreHome, String coreName, String dataDir) throws IOException {
    File coreDataDir = new File(dataDir + "/" + coreName);
    if (coreDataDir.exists()) {
       FileUtils.deleteDirectory(coreDataDir);
    }

    CoreContainer coreContainer = new CoreContainer(solrHome);
    coreContainer.load();

    Properties props = new Properties();
    props.setProperty("dataDir", dataDir + "/" + coreName);

    CoreDescriptor descriptor = new CoreDescriptor(coreContainer, coreName,
            new File(coreHome, coreName).getAbsolutePath(), props);

    SolrCore solrCore = coreContainer.create(descriptor);
    //coreContainer.register(solrCore, false);
    return new EmbeddedSolrServer(coreContainer, coreName);
}
 
开发者ID:bbende,项目名称:solrj-custom-json-update,代码行数:32,代码来源:EmbeddedSolrServerFactory.java

示例2: TestHarness

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
/**
 * @param coreName to initialize
 * @param dataDir path for index data, will not be cleaned up
 * @param solrConfig solrconfig resource name
 * @param indexSchema schema resource name
 */
public TestHarness(String coreName, String dataDir, String solrConfig, String indexSchema) {
  try {
    if (coreName == null)
      coreName = ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME;
    this.coreName = coreName;

    SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
    ConfigSolr config = getTestHarnessConfig(loader, coreName, dataDir, solrConfig, indexSchema);
    container = new CoreContainer(loader, config);
    container.load();

    updater = new UpdateRequestHandler();
    updater.init( null );
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:TestHarness.java

示例3: setupContainer

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
private void setupContainer(int port, String shard) throws IOException,
    ParserConfigurationException, SAXException {
  File data = createTempDir();
  
  System.setProperty("hostPort", Integer.toString(port));
  System.setProperty("shard", shard);
  System.setProperty("solr.data.dir", data.getAbsolutePath());
  System.setProperty("solr.solr.home", TEST_HOME());
  Set<Integer> ports = shardPorts.get(shard);
  if (ports == null) {
    ports = new HashSet<>();
    shardPorts.put(shard, ports);
  }
  ports.add(port);
  CoreContainer container = new CoreContainer();
  container.load();
  assertTrue("Container " + port + " has no cores!", container.getCores()
      .size() > 0);
  containerMap.put(port, container);
  System.clearProperty("solr.solr.home");
  System.clearProperty("hostPort");
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:LeaderElectionIntegrationTest.java

示例4: create

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
/**
 *
 * @param solrHome
 *              path to directory where solr.xml lives
 *
 * @param coreName
 *              the name of the core to load
 * @param dataDir
 *              the data dir for the core
 *
 * @return an EmbeddedSolrServer for the given core
 */
public static SolrServer create(String solrHome, String coreHome, String coreName, String dataDir) {
    File coreDataDir = new File(dataDir + "/" + coreName);
    if (coreDataDir.exists()) {
        coreDataDir.delete();
    }

    CoreContainer coreContainer = new CoreContainer(solrHome);
    coreContainer.load();

    Properties props = new Properties();
    props.setProperty("dataDir", dataDir + "/" + coreName);

    CoreDescriptor descriptor = new CoreDescriptor(coreContainer, coreName,
            new File(coreHome, coreName).getAbsolutePath(), props);

    SolrCore solrCore = coreContainer.create(descriptor);
    coreContainer.register(solrCore, false);
    return new EmbeddedSolrServer(coreContainer, coreName);
}
 
开发者ID:bbende,项目名称:solr-wikipedia,代码行数:32,代码来源:EmbeddedSolrServerFactory.java

示例5: setUp

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    coreContainer = new CoreContainer(solrPath);
    coreContainer.load();

    Assert.assertTrue(coreContainer.isLoaded(CORE_NAME));
    server = new EmbeddedSolrServer(coreContainer, CORE_NAME);
    Assert.assertNotNull(server);
    solrHelper = new SolrHelper(server);
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:11,代码来源:AbstractSolrEnabledTest.java

示例6: initSolrNode

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
protected void initSolrNode(String collection) {
    ClassLoader classLoader = ClassLoader.getSystemClassLoader();
    String solrHomePath = classLoader.getResource(SOLR_HOME).getPath();
    solrNodesContainer = new CoreContainer(solrHomePath);
    solrNodesContainer.load();
    embeddedSolrServer = new EmbeddedSolrServer(solrNodesContainer, collection);
}
 
开发者ID:alessandrobenedetti,项目名称:ltr-tools,代码行数:8,代码来源:SolrBaseTest.java

示例7: createCoreContainer

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
/**
 * Override this to change CoreContainer initialization
 * @return a CoreContainer to hold this server's cores
 */
protected CoreContainer createCoreContainer() {
  SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
  ConfigSolr config = loadConfigSolr(loader);
  CoreContainer cores = new CoreContainer(loader, config);
  cores.load();
  return cores;
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:SolrDispatchFilter.java

示例8: init

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
private CoreContainer init() throws Exception {
  File changed = new File(solrHomeDirectory, "changed");
  copyMinConf(changed, "name=changed");
  // Overlay with my local schema
  schemaFile = new File(new File(changed, "conf"), "schema.xml");
  FileUtils.writeStringToFile(schemaFile, withWhich, Charsets.UTF_8.toString());

  String discoveryXml = "<solr></solr>";
  File solrXml = new File(solrHomeDirectory, "solr.xml");
  FileUtils.write(solrXml, discoveryXml, Charsets.UTF_8.toString());

  final CoreContainer cores = new CoreContainer(solrHomeDirectory.getAbsolutePath());
  cores.load();
  return cores;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ChangedSchemaMergeTest.java

示例9: setUp

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    sequential.lock();
    String solrString = "testdata/solr";
    container = new CoreContainer(solrString);
    container.load();
    solrServer = new EmbeddedSolrServer(container, "sequence");
    control = new SeqrController(solrServer);
    solrServer.deleteByQuery("*:*");
    control.loadJSONDir("testdata/data");

}
 
开发者ID:NCBI-Hackathons,项目名称:seqr,代码行数:13,代码来源:SeqrTest.java

示例10: setUpController

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
private static void setUpController() throws SolrServerException, InterruptedException, IOException {
    String solrString = "testdata/solr";
    container = new CoreContainer(solrString);
    container.load();
    solrServer = new EmbeddedSolrServer(container, "sequence");
    control = new SeqrController(solrServer);
}
 
开发者ID:NCBI-Hackathons,项目名称:seqr,代码行数:8,代码来源:SeqrArgsTest.java

示例11: create

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@PostConstruct
public void create() {
	//embedded options
	Boolean embedded = Boolean.parseBoolean(env.get("solr.embedded", "false"));
	String solrCore = env.get("solr.core", "mamute");
	String solrHome = env.get("solr.home", "");


	//remote options
	String remoteUrl = env.get("solr.url", "");

	if (embedded) {
		LOGGER.info("Starting embedded Solr");
		String home = solrHome;
		if (isEmpty(home)) {
			String locale = env.get("locale");
			LOGGER.info("Using default home, with locale ["+locale+"]");
			home = env.getResource("/solr/"+locale).getPath();
		}

		CoreContainer coreContainer = new CoreContainer(home);
		coreContainer.load();
		server = new EmbeddedSolrServer(coreContainer, solrCore);
	} else if (isNotEmpty(remoteUrl)) {
		LOGGER.info("Connecting to external Solr at [" + remoteUrl + "]");
		server = new HttpSolrServer(remoteUrl);
	} else {
		LOGGER.warn("Solr config options not valid, not initting");
	}
}
 
开发者ID:caelum,项目名称:mamute,代码行数:31,代码来源:SolrServerProvider.java

示例12: startup

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@Before
public void startup() throws IOException, SolrServerException {
  // start an embedded solr instance
  coreContainer = new CoreContainer("solr");
  coreContainer.load();
  solr = new EmbeddedSolrServer(coreContainer, "heron");
  solr.deleteByQuery("*:*");
  solr.commit();
}
 
开发者ID:safarijv,项目名称:ifpress-solr-plugin,代码行数:10,代码来源:HeronSolrTest.java

示例13: startup

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@BeforeClass
public static void startup() throws Exception {
  FileUtils.cleanDirectory(new File("solr/collection1/data/"));
  FileUtils.cleanDirectory(new File("solr/collection1/suggestIndex/"));
  FileUtils.cleanDirectory(new File("solr/heron/data/"));
  // start an embedded solr instance
  coreContainer = new CoreContainer("solr");
  coreContainer.load();
}
 
开发者ID:safarijv,项目名称:ifpress-solr-plugin,代码行数:10,代码来源:SolrTest.java

示例14: getEmbeddedSolrServer

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
protected SolrServer getEmbeddedSolrServer(String solrCore) throws IOException, ParserConfigurationException, SAXException, SolrServerException {
    String solrHomeDir = System.getProperty(SOLR_HOME);
    File home = new File(solrHomeDir);
    File f = new File(home, "solr.xml");
    CoreContainer container = new CoreContainer();
    container.load();
    return new EmbeddedSolrServer(container, solrCore);
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:9,代码来源:SolrServerManager.java

示例15: init

import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@Override
public void init(Path path) throws DatabaseException {
    super.init(path);

    ResourceManager.copyResourcesToPath(this.getStoragePathSuffix(), this.path);

    // Spin Solr up
    logger.debug(String.valueOf(this.path));
    cores = new CoreContainer(this.path.toString());
    cores.load();
    server = new EmbeddedSolrServer(cores, "variants");
}
 
开发者ID:phenotips,项目名称:variant-store,代码行数:13,代码来源:SolrController.java


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