Skip to content

Commit

Permalink
Merge pull request #61 from bigfork/60-queued-deletions
Browse files Browse the repository at this point in the history
Fix queued deletions for archived records (fixes #60)
  • Loading branch information
wilr authored May 16, 2023
2 parents 30811ec + 40e8da1 commit 3dce6c8
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 3dce6c8

Please sign in to comment.