I'm trying to connect to Solr index using Solrj and in paticular EmbeddedSolrServer
. My solr.xml
look like this:
<solr>
<cores adminPath="/admin/cores" defaultCoreName="db">
<core default="true" instanceDir="../db/" name="db"/>
</cores>
</solr>
When executing a query command to the server
CoreContainer coreContainer = new CoreContainer("C:\\development\\solr-4.4.0\\example tasks\\solr");
EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "db");
Collection<SolrCore> cores = coreContainer.getCores();
System.out.println(cores);
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addFacetField("taskType", "taskName");
QueryResponse rsp = server.query(query);
I get the following exception:
Exception in thread "main" org.apache.solr.common.SolrException: No such core: db
The db
core is there and when I start Solr using Jetty and the same solr.xml
file, everything works perfect.