Dealing with the error: A different document with value xxxx already exists in the index

Dealing with the error: A different document with value xxxx already exists in the index

什么会导致目录中的多个文档具有相同的 "unique id"?实际上是这样的错误:

ERROR Products.ZCatalog A different document with value 'xxxx341a9f967070ff2b57922xxxx' already exists in the index.'

我该如何修复它?

我今天也遇到了同样的错误。

简而言之:portal_catalog 中的 UID 索引 (ZCatalog UUIDIndex) 抱怨您正试图用相同的 UID

索引多个对象

在我的例子中,这是由一个文件夹的 zexp 导入引起的,该文件夹包含在另一个文件夹中已经可用的图像。

重现:

  1. 将生产构建、数据库和 blobstorage 复制到登台服务器

  2. 对分期进行一些更改。com/folder1

  3. 移动分期。com/galleries/gallery1 分期。com/folder1

  4. 导出分期。com/folder1 到 folder1.zexp

  5. 删除生产。com/folder1

  6. 在生产中使用 ZMI import/export。com/manage 导入 folder1.zexp

您将收到 gallery1 文件夹及其所有内容项的以下错误:

2015-06-15T17:58:22 ERROR Products.ZCatalog A different document with value '618a9ee3544a4418a1176ac0434cc63b' already exists in the index.'

诊断

生产。com/resolveuid/618a9ee3544a4418a1176ac0434cc63b 会带你去生产。com/galleries/gallery1/image1

而 staging/resolveuid/618a9ee3544a4418a1176ac0434cc63b 将带您到舞台。com/folder1/gallery1/image1

production.com/folder1/gallery1/image1 确实也被编目了,但是因为它与 production.com/galleries/gallery/image1 的 uid 相同,所以 resolveuid、目录查询、内部链接等的结果可能是随机

如何修复

就我而言,我认为这可能是最好的选择

  • 删除 production.com/galleries/gallery1 和 运行 清除并重建门户目录。
  • 或替换制作。com/folder1/画廊由制作。com/galleries/gallery1(删除、剪切、粘贴)

如果具有相同 UID 的对象实际上并不相同(如我的情况),您可以使用 object._setUID('new-uid') 为它们提供新的和唯一的 UIDS,然后重建目录。