使用 solrj 进行 solr 事务管理 [英] solr transaction management using solrj

查看:37
本文介绍了使用 solrj 进行 solr 事务管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Solrj 处理 Solr 中的事务管理?网络上没有太多与此相关的文档.但如果有人可以提供与使用 SolrJ 进行事务管理相关的任何链接或信息,我将不胜感激.

How to handle transaction management in Solr using Solrj? There is not much documentation related to this on the net. But I would appreciate if someone can provide any links or information related to transaction management using SolrJ.

推荐答案

您必须以编程方式处理 SolrJ 中的事务.处理多个写入时.

You would have to programatically deal with the transactions in SolrJ. When dealing with multiple writes.

  1. 使用 SolrServer api add 方法将 SolrInputDoucments 添加到服务器.
  2. 添加所有 SolrInputDocument 后,从 SolrServer api 调用 commit 方法以提交所有更改.
  3. 如果 Solr 出现异常,如果您想回滚对 Solr 的写入,请调用 SolServer api 回滚方法.
  4. 如果您还想回滚对数据库的写入,只需从 catch 块中抛出运行时异常即可.

这就是我处理事务管理的方式.如果有人有更好的答案,请随时改进答案.

This is how I dealt with the transaction management. If anyone has better answers, please feel free to improve the answer.

这篇关于使用 solrj 进行 solr 事务管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆