From e8fa704a9888cac9ae7e88c773d8cedd89aafce8 Mon Sep 17 00:00:00 2001 From: Alexander Stammbach Date: Mon, 6 May 2024 19:39:24 +0200 Subject: [PATCH] Allow Typesense Search Parameter Definition on Models (#827) * Allow Typesense Search Parameter Definition on Models * Added Parameters to array_merge --- src/Engines/TypesenseEngine.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Engines/TypesenseEngine.php b/src/Engines/TypesenseEngine.php index e4bedbab..fd12b076 100644 --- a/src/Engines/TypesenseEngine.php +++ b/src/Engines/TypesenseEngine.php @@ -261,6 +261,10 @@ public function buildSearchParameters(Builder $builder, int $page, int|null $per 'highlight_affix_num_tokens' => 4, ]; + if (method_exists($builder->model, 'typesenseSearchParameters')) { + $parameters = array_merge($parameters, $builder->model->typesenseSearchParameters()); + } + if (! empty($builder->options)) { $parameters = array_merge($parameters, $builder->options); }