lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "Solrj" by ShalinMangar
Date Thu, 02 Jul 2009 16:37:41 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by ShalinMangar:
http://wiki.apache.org/solr/Solrj

The comment on the change is:
Fixing usage of EmbeddedSolrServer to not use deprecated APIs

------------------------------------------------------------------------------
  
  {{{
  
-   SolrCore core = SolrCore.getSolrCore();
+   // Note that the following property could be set through JVM level arguments too
+   System.setProperty("solr.solr.home", "/home/shalinsmangar/work/oss/branch-1.3/example/solr");
+   CoreContainer.Initializer initializer = new CoreContainer.Initializer();
+   CoreContainer coreContainer = initializer.initialize();
-   SolrServer server = new EmbeddedSolrServer( core );
+   EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "");
-   ...
  
  }}} 
  
  If you want to use MultiCore features, then you should use this:
  {{{
-     File home = new File( getSolrHome() );
+     File home = new File( "/path/to/solr/home" );
      File f = new File( home, "solr.xml" );
-     multicore.load( getSolrHome(), f );
+     CoreContainer container = new CoreContainer();
+     container.load( "/path/to/solr/home", f );
  
-     EmbeddedSolrServer server = new EmbeddedSolrServer( multicore, "core name as defined
in solr.xml" );
+     EmbeddedSolrServer server = new EmbeddedSolrServer( container, "core name as defined
in solr.xml" );
      ...
  }}}
  

Mime
View raw message