diff --git a/src/Engines/TypesenseEngine.php b/src/Engines/TypesenseEngine.php index 73ae4365..2b3825fd 100644 --- a/src/Engines/TypesenseEngine.php +++ b/src/Engines/TypesenseEngine.php @@ -504,11 +504,12 @@ protected function getOrCreateCollectionFromModel($model, bool $indexOperation = if ($collection->exists()) { // Also check if the collection exists in Typesense to avoid potential errors $collectionName = $model->{$method}(); - try { + + try { $this->typesense->collections[$collectionName]->retrieve(); $collectionExists = true; - } catch (TypesenseClientError $e){ - $collectionExists = false; + } catch (TypesenseClientError $e) { + // No need to do anything here, collectionExists will remain false } }