首页 > Web开发 > 详细

JSON方式提交文档时SOLR报:AtomicUpdateDocumentMerger Unknown operation for the an atomic update, operation ignored

时间:2016-12-01 13:56:52      阅读:328      评论:0      收藏:0      [点我收藏+]

文档是数组转成的json

原数组:

array(
  0 =>3,
  1 =>3,
  2 =>4,
  3 =>5,
  4 =>5,
  5 =>6
)

用array_unique去掉数组中重复的元素后,插入时报错。

原因:

  array_unique去重之后,原数组的下标被保留了。数组为

array(
  0 =>3,
  2 =>4,
  3 =>5,
  5 =>6
)

在json_encode数组时,会把下标不连续的数组解析成json字符串例如{"0":"3","2":"4","3":"5","5":6}。期望的是{["3","4","5","6"]}。造成这个报错的原因是下标不连续。需重组一下索引,因此在array_unique之后,再执行array_values,将数组的下标重排列。这样,在向solr的update handler 提交时就不会被认为是在做原子更新了。

JSON方式提交文档时SOLR报:AtomicUpdateDocumentMerger Unknown operation for the an atomic update, operation ignored

原文:http://www.cnblogs.com/mysic/p/6121318.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!