Skip to content

Commit

Permalink
Fix queued deletions for archived records (fixes #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinglozzer committed May 15, 2023
1 parent 30811ec commit 40e8da1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Service/AlgoliaIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 40e8da1

Please sign in to comment.