Search code examples
solrdataimporthandler

delta-import problem in solr DIH


When I run full_import command it is working fine. The updated dates are written to dataimport.properties file. When I run delta-import it is giving Indexing failed. Rolled back all changes.. The dataimport.properties file was already created and have the 777 permissions in solr/conf/ location.

Please Help me to solve this problem.


@mbonaci

the query,deltaImportQuery and deltaQuery in data-config.xml is as follows

    <entity name="item" query="select group_title,description,DATE_FORMAT(created_date, '%Y-%m-%dT%H:%i:%sZ') as createdDate,group_status, 'GROUP' as itemtype,group_id as id from collaboration_groups where group_status=1" 
deltaImportQuery="select group_title,description,DATE_FORMAT(created_date, '%Y-%m-%dT%H:%i:%sZ') as createdDate,group_status,group_id as id,'GROUP' as itemtype  from collaboration_groups where group_status=1 and group_id=${dataimporter.delta.id} "  
deltaQuery="select group_id from collaboration_groups where group_status=1 and  updated_date &gt; '${dataimporter.last_index_time}'" deletedPkQuery="select group_id  from  collaboration_groups  where group_status = 0 and updated_date &gt; '${dataimporter.last_index_time}'">
            <field column="id"  name="id" />
            <field column="itemtype" name="itemtype" />
            <field column="group_title" name="fullName" />
            <field column="description" name="description"/>
            <field column="createdDate" name="createdDate"/>
</entity>

the config parameter of the dataImport request handler in config.xml is as follows

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

Solution

  • I noticed that, in your deltaImportQuery you referenced id (which doesn't exist in your deltaQuery) instead of group_id. In this line:

    ...and group_id=${dataimporter.delta.id}"
    

    Since your PK in deltaQuery is group_id, that part of query should go like this:

    ...and group_id=${dataimporter.delta.group_id}"
    

    I had that same problem, cuz' I did not understand that ${dataimporter.delta} in fact represents deltaQuery.