Note: This ticket was drafted with the help of AI. The bug itself was hit on a real production Drupal 11 site and independently reproduced on a fresh Drupal CMS 11.4.5 install, no contrib beyond search_api + search_api_db, no custom code. The steps below were run by hand.
Problem/Motivation
Adding a translation while the node is in a pending (non-default) moderation state silently corrupts the Search API tracker. The translation still reaches the backend at publish time, so listings look correct — but the tracker never gets the row. The damage is invisible until the backend is repopulated from the tracker (a full reindex, backend rebuild, Solr schema refresh, migration), at which point every accumulated missing translation disappears from every view backed by the index, at once.
Steps to reproduce
Fresh Drupal CMS 11.4.5 install.
- Add French. Enable translation on the
pagebundle. Apply thebasic_editorialworkflow topage. - Create a database-backed index on
entity:node, defaults left as-is (index_directly: TRUE,delete_on_fail: TRUE). - Create an EN page
N, moderation state Published.search_api_itemcontainsentity:node/N:en. ✔
- Visit
/fr/node/N/translations/add/en/fr, fill in, moderation state Draft, save.- Watchdog:
Could not load the following items on index Content: "entity:node/N:fr". SELECT item_id FROM search_api_item WHERE item_id LIKE 'entity:node/N:%'→ onlyentity:node/N:en. ✘
- Watchdog:
- Visit
/fr/node/N/edit, moderation state Published, save.- Backend
search_api_db_content:en+fr. Listing shows FR. ✔ search_api_item: still onlyen. Row never recreated. ✘
- Backend
drush search-api:clear content && drush search-api:index content.- Backend now contains only
en. FR row disappears from every view backed by the index.
- Backend now contains only
Proposed resolution
Patch to follow.
Remaining tasks
Review of the attached patch
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | search_api-3620036-do-not-track-pending-revision-translations.patch | 1.39 KB | guillaumeg |
Comments
Comment #2
guillaumeg commented