I am having trouble getting an EmbeddedSolrServer
to run. The JavaDoc for CoreContainer
is sparse to say the least. I've looked at the "MergeIndexesEmbeddedTest" and my code seems like it should work. (This is a Maven project) I have both "Schema.xml" and "solr.xml" in the root of the src/main/resources
folder. I can able to instantiate ther server, but when I try to add a SolrInputDocument
to the the server I get:
org.apache.solr.common.SolrException: 'No such core: butterfly'
at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:104)
at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:64)
My code that sets up the server is:
final File solrConfigXml = new File( "C:/code/butterfly/src/main/resources/solr.xml" );
final String solrHome = "C:/code/butterfly/src/main/resources/";
CoreContainer coreContainer;
try{
coreContainer = new CoreContainer( solrHome, solrConfigXml );
}catch( Exception e ){
e.printStackTrace( System.err );
throw new RuntimeException( e );
}
solrServer = new EmbeddedSolrServer( coreContainer, "butterfly" );
and my solr.xml
file is:
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
<cores adminPath="/admin/cores" defaultCoreName="butterfly1">
<core name="butterfly" instanceDir="." />
</cores>
</solr>
I haven't posted my Schema.xml
file since it is just a pruned version of the example one with different field names. I am using absolute files path just because it seemed easier to just get started.
In your solr.xml snippet, the defaultCoreName is butterfly1. There is no core with name =butterfly1 in your schema.
What version of solr server are you using ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With