Vikash
Vikash

Reputation: 663

solr dataimport from multiple data-config.xml file

I have created two config file one is data-config.xml and onather is data-config- original.xml and in solrconfig.xml i have made entry as follows

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

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

    and i imports theses file using below url:
    http://hostname:8080/solr/dataimport2?command=full-import
    and
    http://hostname:8080/solr/dataimport?command=full-import
    but its shows only one indexed file at a time, when i see using below url:
    http://hostname:8080/solr/select/?q=*&version=2.2&start=0&rows=10&indent=on
    how can i import and indexed form multiple file or databases?

Upvotes: 2

Views: 5744

Answers (2)

Vikash
Vikash

Reputation: 663

Got the answer of my question. No need to make two configuration file of data-config, make only once. Only its configuration should be like below configuration.

<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
    <dataSource type="JdbcDataSource"
    convertType="true"
   driver="com.mysql.jdbc.Driver"
   url="jdbc:mysql://localhost:3306/db1"
   user="root"
   password=""
   name="jdbcmy01nvn1"
   autoCommit="true" batchSize="-1"
   />
   <dataSource type="JdbcDataSource"
    convertType="true"
   driver="com.mysql.jdbc.Driver"
   url="jdbc:mysql://localhost:3306/bd2"
   user="root"
   password=""
   name="jdbcmy01nvn"
   autoCommit="true" batchSize="-1"
   />
<document name="doc1">
    <entity dataSource="jdbcmy01nvn1" name="cont1" query="" >
    <field column = "" name="" />
    </entity>
    <entity dataSource="jdbcmy01nvn" name="cont" query="" >
    <field column = "" name="" />
    </entity>
</document>

</dataConfig>

Only name of dataConfig tag should be change and used as dataSource="" in entity tag inside document tag.

Upvotes: 1

Jayendra
Jayendra

Reputation: 52799

DIH Commands

With command=full-import, the clean default parameter is true, which would delete all records before indexing

clean : (default 'true'). Tells whether to clean up the index before the indexing is started.

So make sure clean=false is passed.

Also, make sure the ids are unique else the documents would overwrite each other.

Upvotes: 0

Related Questions