lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikhil Chhaochharia <nikhil...@yahoo.com>
Subject Re: CoreDescriptor explanation and possible bug
Date Thu, 28 Aug 2008 14:06:44 GMT
Thanks Henri, this is the kind of snippet I was looking for.

However, the CoreDescriptor constructor and method used below are not present in the codebase.
CoreDescriptor dcore = new CoreDescriptor("",solrConfig.getResourceLoader().getInstanceDir());
dcore.setCoreContainer(container);

I am assuming that these are part of some patch which will get applied before 1.3 releases,
is that correct ?

Nikhil




----- Original Message ----
From: Henrib <hbiestro@gmail.com>
To: solr-user@lucene.apache.org
Sent: Thursday, 28 August, 2008 7:04:12 PM
Subject: Re: CoreDescriptor explanation and possible bug


Seems you want something like:

  public SolrCore nikhilInit(final IndexSchema indexSchema) {
    final String solrConfigFilename = "solrconfig.xml"; // or else
    CoreContainer.Initializer init = new CoreContainer.Initializer() {
      @Override
      public CoreContainer initialize() {
      CoreContainer container = new CoreContainer(new
SolrResourceLoader(SolrResourceLoader.locateInstanceDir()));
        SolrConfig solrConfig = solrConfigFilename == null ? new
SolrConfig() : new SolrConfig(solrConfigFilename);
        CoreDescriptor dcore = new CoreDescriptor("",
solrConfig.getResourceLoader().getInstanceDir());
        dcore.setCoreContainer(container);
        dcore.setConfigName(solrConfig.getResourceName());
        dcore.setSchemaName(indexSchema.getResourceName());
        SolrCore core = new SolrCore( "", null, cfg, indexSchema, dcore);
        container.register("", core, false);
        return container;
    }
    };
    return init.initialize().getCore("");
  }


-- 
View this message in context: http://www.nabble.com/CoreDescriptor-explanation-and-possible-bug-tp19197004p19200585.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message