Skip to content

Commit

Permalink
fix(typesense): skip collection check for search operations
Browse files Browse the repository at this point in the history
- Add early return for search operations in `getOrCreateCollectionFromModel`
- Maintain collection existence check only when `indexOperation` is true
- Optimize search performance by reducing unnecessary API calls
  • Loading branch information
tharropoulos committed Dec 18, 2024
1 parent 480adfa commit 3f6d47b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Engines/TypesenseEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ protected function getOrCreateCollectionFromModel($model, bool $indexOperation =
$collectionName = $model->{$method}();
$collection = $this->typesense->getCollections()->{$collectionName};

if (!$indexOperation) {
return $collection;
}

// Determine if the collection exists in Typesense...
try {
$collection->retrieve();
Expand Down

0 comments on commit 3f6d47b

Please sign in to comment.