solr DIH 中的增量导入问题

发布于 2024-10-20 13:54:31 字数 1682 浏览 2 评论 0原文

当我运行 full_import 命令时,它工作正常。更新日期将写入 dataimport.properties 文件。当我运行 delta-import 时,它给出索引失败。回滚所有更改。dataimport.properties 文件已创建,并且在 solr/conf/ 位置具有 777 权限。

请帮我解决这个问题。


@mbonaci

data-config.xml 中的查询、deltaImportQuery 和 deltaQuery 如下

    <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>

config.xml 中 dataImport 请求处理程序的配置参数如下

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

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 > '${dataimporter.last_index_time}'" deletedPkQuery="select group_id  from  collaboration_groups  where group_status = 0 and updated_date > '${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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

番薯 2024-10-27 13:54:31

我注意到,在您的 deltaImportQuery 中,您引用了 id(您的 deltaQuery 中不存在)而不是 group_id。在这一行中:

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

由于 deltaQuery 中的 PK 是 group_id,所以查询的那部分应该像这样:

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

我也遇到了同样的问题,因为我不明白 ${dataimporter.delta} 实际上代表deltaQuery。

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.

踏月而来 2024-10-27 13:54:31

您可以查看您的 dataConfig 文件并发布您的查询deltaImportQuerydeltaQuery 吗?
dataConfig 直接位于 solrconfig.xml 中的 dataImport 请求处理程序标记内,或者位于单独的 xml 文件中。要找出哪个文件,请查看 dataImport 请求处理程序的配置参数,该参数应该类似于以下内容:

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

包含 dataConfig 的文件位于与 solrconfig.xml (conf) 相同的目录中。

Can you look at your dataConfig file and post your query, deltaImportQuery and deltaQuery?
dataConfig is located either directly in your solrconfig.xml, inside dataImport request handler tag or it's in separate xml file. To find out which file check out config parameter of the dataImport request handler, which is supposed to look similar to this:

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

The file containing dataConfig is located in the same directory as solrconfig.xml (conf).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文