A different document with value '...' already exists in the index.
...and after this warning / error I have a broken brain in catalog that won't update no matter what I do to the object (my issue is with the review_state which remained in pending and now the object is published but not appearing in listings).
Tried also to manually uncatalog the object via ZMI and debugger, reindex, etc. No luck.
Removing the object and manually uncatalog it may help, but that's not an option
I wonder what could led to duplicate UIDs in portal_catalog and if there are any tools to clean or debug large catalogs without having to rebuild the entire catalog?
We have seen this issue on a portal where sub sites were exported using zexp and afterwards re-imported again at a different location/folder in the portal. (situation was bit more complicated, for brevity). Then you can get duplicate UID's.
@mauritsvanrees improved collective.catalogcleanup last year to also check for these UID & other problems.
But now that you mention discussion items: I have no idea... what happens if you copy/paste an CT item that has discussion items 'attached'? Are these discussion items dropped? Do they have UID's? Are these recalculated?
clearing review_state and path indexes and re-index them via ZMI. Then I re-published the object.
Number of indexed objects: ~78k Duration: ~4min
Listings with filters based on review_state or path will be empty during reindex.
You may have to tweak Subtransaction threshold via ZMI > portal_catalog > Advanced if you have a site with lot of editors or even close it for authenticated users during this operation. Thus. never apply directly on production . Always try it first on staging.
I don't think the issue is completely fixed as some other indexes may still have the wrong data (that's why I also reindexed the path index as the broken brain were still visible in ZMI when filtering by path).