Solr 3.6.2 - multi cores doesn't take configured parameters dataDir

 when using solr 3.6.2 and multi core option and you want to config the dataDir location(other wise it will save it in the target and in each deployment you will loose your index! dataDir 

<solr persistent="true"> <cores adminPath="/admin/cores">
  <core name="core0" instanceDir="core0">
    <property name="dataDir" value="mylocation/data/core0" />
  <core name="core1" instanceDir="core1" />
     <property name="dataDir" value="mylocation/data/core1" />


well, now i was expected that when i create the SolrCore the data dir will get my propertiy and not the default one...


the blame is in the dcore) method.

the only place that initiate the solrCore is the constrocture, and in the create method it pass null in this costroctor... (line 480)


my solution was to overide the create method and pass the dataDir param:

     // get the dataDir from properties and pass it to SolrCore (this is the bug!!!)
     String dataDir = dcore.getCoreProperties().getProperty(CoreAdminParams.DATA_DIR, null);
     SolrCore core = new SolrCore(dcore.getName(), dataDir, config, schema, dcore);
     // SolrCore core = new SolrCore(dcore.getName(), null, config, schema, dcore);





Share this article: