From 40e8da13f439355dda3d68c142d3ae1c6651fc98 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Mon, 15 May 2023 16:08:13 +0100 Subject: [PATCH] Fix queued deletions for archived records (fixes #60) --- src/Service/AlgoliaIndexer.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Service/AlgoliaIndexer.php b/src/Service/AlgoliaIndexer.php index 63ec1c6..8fda0ba 100644 --- a/src/Service/AlgoliaIndexer.php +++ b/src/Service/AlgoliaIndexer.php @@ -327,16 +327,14 @@ public function exportAttributesFromRelationship($item, $relationship, $attribut */ public function deleteItem($itemClass, $itemUUID) { - $item = DataObject::get($itemClass)->find('AlgoliaUUID', $itemUUID); - - if (!$item || !$item->isInDB()) { + if (!$itemUUID) { return false; } $searchIndexes = $this->getService()->initIndexes(); foreach ($searchIndexes as $key => $searchIndex) { - $searchIndex->deleteObject($item->AlgoliaUUID); + $searchIndex->deleteObject($itemUUID); } return true;