Problem/Motivation
Watchdog is full of messages reporting:
"Could not load the following items on index Search_index: "entity:product/3105444:it", "entity:product/2056973:it", "entity:product/2114185:it". "
Steps to reproduce
In the index config I have disabled the indexing of a specific language for the content type product because we use another search engine there, but the translation exists.
When saving an italian translation of an entity, we see the above error message.
Proposed resolution
We check validity of content when inserting but not when updating/deleting an entity. I propose we ought to do the same.
Basically in ContentEntityTrackingManager.php::trackEntityChange we should change the following:
foreach ($indexes as $index) {
if ($inserted_ids) {
$filtered_item_ids = $this->filterValidItemIds($index, $datasource_id, $inserted_ids);
$index->trackItemsInserted($datasource_id, $filtered_item_ids);
}
if ($updated_ids) {
$index->trackItemsUpdated($datasource_id, $updated_ids);
}
if ($deleted_ids) {
$index->trackItemsDeleted($datasource_id, $deleted_ids);
}
}
to:
foreach ($indexes as $index) {
if ($inserted_ids) {
$filtered_item_ids = $this->filterValidItemIds($index, $datasource_id, $inserted_ids);
$index->trackItemsInserted($datasource_id, $filtered_item_ids);
}
if ($updated_ids) {
$filtered_item_ids = $this->filterValidItemIds($index, $datasource_id, $updated_ids);
$index->trackItemsUpdated($datasource_id, $filtered_item_ids);
}
if ($deleted_ids) {
$filtered_item_ids = $this->filterValidItemIds($index, $datasource_id, $deleted_ids);
$index->trackItemsDeleted($datasource_id, $filtered_item_ids);
}
}
Is there something I've done wrong somewhere which means this isn't necessary? The entity translation exists in my DB but the index item does not and seems correct to me. I have already tried deleting the entire index and rebuilding
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3246615-4--error_on_update_of_ignored_translation.patch | 6.46 KB | drunken monkey |
Comments
Comment #2
drunken monkeyThanks a lot for reporting this problem, and sorry it took me a while to respond.
I could indeed easily reproduce this bug, seems like a small oversight. The attached should fix it. Please test/review.
Comment #4
drunken monkeyWould you mind giving this a try so I can commit it? Thanks!
(Attaching revision just fixing the code style problem.)
Comment #6
drunken monkeyCommitted.
Comment #8
miiimoooI'm not the original reporter of this issue but I can confirm it fixed this issue for me too.