You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that when updating an entry split into multiple rows (splitElementsOn), the previous rows are only deleted if the new value for the property has 2 elements or more, so basically if null, an empty array, or an array with 1 item is returned for the property on the transformer, the previous rows are not deleted and left as orphans.
I'm currently using the split elements functionality for a rich text field on craft, where each paragraph is split into a new row, and this means that if I currently have a text with 4 paragraphs (so 4 rows on algolia), then I edit the text and remove all the paragraphs, I'm now left with 5 items, a correct one with an empty text, and the previous 4 rows.
Going back to the entry, and removing a lot of text, causing it to be just one part, I get 4 records in the index
objectID "100" (with the updated content)
objectID "100_0" (with the old content)
objectID "100_1" (with the old content)
objectID "100_2" (with the old content)
All of them with a distinctID of 100, and all searchable.
_0, _1 and _2 should have been deleted before adding the updated data/record.
I think this is related to the logic on line 37 to 48 in Engine.php.
Due to the continue statement in there, the $objectsToDelete array will be always empty if the number of "splits" currently is <= 1, leading to the orphans in the index.
I've tagged this in 3.3.3-beta.2 - since we already had a beta running to fix ongoing issues with deletions not going through in some cases (with split elements as well).
Could you give this a try and see if it fixes things?
Hello,
It seems that when updating an entry split into multiple rows (splitElementsOn), the previous rows are only deleted if the new value for the property has 2 elements or more, so basically if null, an empty array, or an array with 1 item is returned for the property on the transformer, the previous rows are not deleted and left as orphans.
I'm currently using the split elements functionality for a rich text field on craft, where each paragraph is split into a new row, and this means that if I currently have a text with 4 paragraphs (so 4 rows on algolia), then I edit the text and remove all the paragraphs, I'm now left with 5 items, a correct one with an empty text, and the previous 4 rows.
STU-130
The text was updated successfully, but these errors were encountered: