Skip to content

Commit 2fe33e6

Browse files
authored
perf(typesense): skip collection check for search operations (#898)
* fix(typesense): skip collection check for search operations - 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 * lint
1 parent 480adfa commit 2fe33e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Engines/TypesenseEngine.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,10 @@ protected function getOrCreateCollectionFromModel($model, bool $indexOperation =
603603
$collectionName = $model->{$method}();
604604
$collection = $this->typesense->getCollections()->{$collectionName};
605605

606+
if (! $indexOperation) {
607+
return $collection;
608+
}
609+
606610
// Determine if the collection exists in Typesense...
607611
try {
608612
$collection->retrieve();

0 commit comments

Comments
 (0)