When solr core is being created (in my case from solrj lib) the parameter
dataDir is ignored, the value from solrconfig.xml is used instead it.
Under debugger I find strange place in org.apache.solr.core.CoreContainer
(solr version 1.4):

public SolrCore create(CoreDescriptor dcore)  throws
ParserConfigurationException, IOException, SAXException {
    ...
    // my comment: here second parameter (which is null) is dataDir but
dcore has true dataDir value
    SolrCore core = new SolrCore(dcore.getName(), null, config, schema,
dcore);
    return core;
}

why dataDir is null in this SolrCore construction?
Or there is another place where dataDir should be properly set, this is in
SolrCore constructor:

public SolrCore(String name, String dataDir, SolrConfig config, IndexSchema
schema, CoreDescriptor cd) {
    ...
    if (dataDir == null){
       dataDir =  config.getDataDir();
       if(dataDir == null) dataDir = cd.getDataDir();
    }

    dataDir = SolrResourceLoader.normalizeDir(dataDir);
    ...
}

My opinion is when core is creating dataDir should be firstly set from
CoreDescriptor parameter and only if its dataDir is null then retrieve
dataDir from global solr config file.
Is this bug or I insufficiently understand core creating behavior?

Many thanks,
Sergei

Reply via email to