Skip to content

Commit 4b76635

Browse files
authored
Merge pull request #60 from typesense/bugfix/soft_deleted
Bugfix Dont update Typesense document if the model is soft-deleted
2 parents 8349b5c + eeccb1f commit 4b76635

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Engines/TypesenseEngine.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,10 @@ public function update($models): void
168168
$models->each->pushSoftDeleteMetadata();
169169
}
170170

171-
$this->typesense->importDocuments($collection, $models->map(fn($m) => $m->toSearchableArray())
172-
->toArray());
171+
if (is_null($models->first()?->deleted_at)) {
172+
$this->typesense->importDocuments($collection, $models->map(fn($m) => $m->toSearchableArray())
173+
->toArray());
174+
}
173175
}
174176

175177
/**

0 commit comments

Comments
 (0)