mirror of https://github.com/apache/lucene.git
SOLR-721 -- DirectSolrConnection now uses CoreContainers
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@702993 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
28ef53258d
commit
130a2022b1
|
@ -29,8 +29,11 @@ import org.apache.solr.common.params.MapSolrParams;
|
||||||
import org.apache.solr.common.params.SolrParams;
|
import org.apache.solr.common.params.SolrParams;
|
||||||
import org.apache.solr.common.util.ContentStream;
|
import org.apache.solr.common.util.ContentStream;
|
||||||
import org.apache.solr.common.util.ContentStreamBase;
|
import org.apache.solr.common.util.ContentStreamBase;
|
||||||
|
import org.apache.solr.core.CoreContainer;
|
||||||
|
import org.apache.solr.core.CoreDescriptor;
|
||||||
import org.apache.solr.core.SolrConfig;
|
import org.apache.solr.core.SolrConfig;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
|
import org.apache.solr.core.SolrResourceLoader;
|
||||||
import org.apache.solr.request.QueryResponseWriter;
|
import org.apache.solr.request.QueryResponseWriter;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.request.SolrQueryResponse;
|
import org.apache.solr.request.SolrQueryResponse;
|
||||||
|
@ -101,16 +104,19 @@ public class DirectSolrConnection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize SolrConfig
|
if( instanceDir == null ) {
|
||||||
SolrConfig config = null;
|
instanceDir = SolrResourceLoader.locateInstanceDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize
|
||||||
try {
|
try {
|
||||||
config = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null);
|
CoreContainer cores = new CoreContainer(new SolrResourceLoader(instanceDir));
|
||||||
instanceDir = config.getResourceLoader().getInstanceDir();
|
SolrConfig solrConfig = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null);
|
||||||
|
CoreDescriptor dcore = new CoreDescriptor(cores, "", solrConfig.getResourceLoader().getInstanceDir());
|
||||||
// If the Data directory is specified, initialize SolrCore directly
|
IndexSchema indexSchema = new IndexSchema(solrConfig, instanceDir+"/conf/schema.xml", null);
|
||||||
IndexSchema schema = new IndexSchema(config, instanceDir+"/conf/schema.xml", null);
|
core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore);
|
||||||
core = new SolrCore( null, dataDir, config, schema, null );
|
cores.register("", core, false);
|
||||||
parser = new SolrRequestParsers( config );
|
parser = new SolrRequestParsers( solrConfig );
|
||||||
}
|
}
|
||||||
catch (Exception ee) {
|
catch (Exception ee) {
|
||||||
throw new RuntimeException(ee);
|
throw new RuntimeException(ee);
|
||||||
|
|
Loading…
Reference in New Issue