Hello every body,

referring to the link : http://wiki.apache.org/solr/CoreAdmin.

I've created a solr.xml file as follows:

<solr persistent="true" sharedLib="lib">
 <property name="snapshooter" value="/home/solr-user/solr/
bin/snapshooter.sh" />
 <cores adminPath="/admin/cores" shareSchema="false"
adminHandler="fr.splayce.solr.handler.MyAdminHandler">
  <core name="core1" instanceDir="core0">
    <property name="dataDir" value="/core0/data" />
  </core>
  <core name="core2" instanceDir="core1"/>
      <property name="dataDir" value="/core1/data" />
 </cores>
</solr>

So before using SolrCore I instanciated a SolrServer to index and search
documents as follows:

            System.setProperty("solr.solr.home", "solr");
            CoreContainer.Initializer initializer = new
CoreContainer.Initializer();
            CoreContainer coreContainer = initializer.initialize();
            server = new EmbeddedSolrServer(coreContainer, "");

And then to  index a document  : server.add(doc) and to search :
server.query(...).

So with SolrCore I've create MyAdminHandler by overrinding
handleCistomAction method like this (as mentionned in the link):

protected boolean handleCustomAction(SolrQueryRequest req, SolrQueryResponse
rsp) {
        CoreContainer container = super.getCoreContainer();
         SolrCore mycore1 = container.getCore("core1");
         SolrCore mycore2 = container.getCore("core2");

So how I could index and search document within the 2 index?

Thank you for your help.

Reply via email to