Search code examples
solrdataimporthandler

requestHandler code for multiple core


I created two core and they are showing http://{localhost}:8983/solr/ and which I click on them the admin panel is opened. The solr.xml files has below given code.

<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="true" >
  <cores adminPath="/admin/cores">
    <core name="core0" instanceDir="core0" />
    <core name="core1" instanceDir="core1" />
  </cores>
</solr>

And I create the folder accordingly. But when I try to add handler to it suppose to core1 in the core1->config->solrconfig.xml , the core0 disappears from the core list

The core for requesthandler is given below.

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">data-config.xml</str>
  </lst>
</requestHandler>

I even tried passing the core name with handler i.e

<requestHandler name="/core0/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">data-config.xml</str>
  </lst>
</requestHandler>

But it did not work.

Do I need to change something else in order to run two cores?


Solution

  • You don't need the core entry in the solrconfig.xml.

       <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
        <lst name="defaults">
            <str name="config">data-config.xml</str>
        </lst>
      </requestHandler>  
    

    You can handle the data import for individual cores

    core0 - http://localhost:8983/solr/core0/admin/dataimport.jsp?handler=/dataimport

    core1 - http://localhost:8983/solr/core1/admin/dataimport.jsp?handler=/dataimport