solr DIH 中的增量导入问题
当我运行 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 > '${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>
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我注意到,在您的
deltaImportQuery
中,您引用了id
(您的 deltaQuery 中不存在)而不是group_id
。在这一行中:由于 deltaQuery 中的 PK 是 group_id,所以查询的那部分应该像这样:
我也遇到了同样的问题,因为我不明白
${dataimporter.delta}
实际上代表deltaQuery。I noticed that, in your
deltaImportQuery
you referencedid
(which doesn't exist in your deltaQuery) instead ofgroup_id
. In this line:Since your PK in deltaQuery is group_id, that part of query should go like this:
I had that same problem, cuz' I did not understand that
${dataimporter.delta}
in fact representsdeltaQuery
.您可以查看您的
dataConfig
文件并发布您的查询
、deltaImportQuery
和deltaQuery
吗?dataConfig
直接位于solrconfig.xml
中的 dataImport 请求处理程序标记内,或者位于单独的 xml 文件中。要找出哪个文件,请查看 dataImport 请求处理程序的配置参数,该参数应该类似于以下内容:包含
dataConfig
的文件位于与 solrconfig.xml (conf) 相同的目录中。Can you look at your
dataConfig
file and post yourquery
,deltaImportQuery
anddeltaQuery
?dataConfig
is located either directly in yoursolrconfig.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:The file containing
dataConfig
is located in the same directory as solrconfig.xml (conf).