List of usage examples for org.apache.solr.core CoreDescriptor CORE_SCHEMA
String CORE_SCHEMA
To view the source code for org.apache.solr.core CoreDescriptor CORE_SCHEMA.
Click Source Link
From source file:com.indoqa.solr.spring.client.EmbeddedSolrServerBuilder.java
License:Apache License
public static SolrClient build(String url, String embeddedSolrConfigurationPath) { if (new File(embeddedSolrConfigurationPath).exists()) { deleteOldCoreProperties(embeddedSolrConfigurationPath); SolrResourceLoader loader = new SolrResourceLoader(getNormalizedPath(embeddedSolrConfigurationPath)); NodeConfig nodeConfig = new NodeConfigBuilder(null, loader).build(); CoreContainer container = new CoreContainer(nodeConfig); container.load();// w w w. jav a 2 s.co m Map<String, String> properties = new HashMap<String, String>(); properties.put(CoreDescriptor.CORE_DATADIR, getNormalizedPath(getDataDir(url)).toString()); SolrCore core = container.create(CORE_NAME, loader.getInstancePath(), properties); return new EmbeddedSolrServer(core); } // use a temporary directory for the resource loader because Solr needs a real directory for this SolrResourceLoader loader = new SolrResourceLoader(createTempDirectory()); NodeConfig nodeConfig = new NodeConfigBuilder(null, loader).build(); CoreContainer container = new CoreContainer(nodeConfig); container.load(); Map<String, String> properties = new HashMap<String, String>(); properties.put(CoreDescriptor.CORE_DATADIR, getNormalizedPath(getDataDir(url)).toString()); properties.put(CoreDescriptor.CORE_CONFIG, embeddedSolrConfigurationPath + "/conf/solrconfig.xml"); properties.put(CoreDescriptor.CORE_SCHEMA, embeddedSolrConfigurationPath + "/conf/schema.xml"); SolrCore core = container.create(CORE_NAME, loader.getInstancePath(), properties); return new EmbeddedSolrServer(core); }