diff --git a/src/Engines/TypesenseEngine.php b/src/Engines/TypesenseEngine.php index d211e7b..7c581ac 100644 --- a/src/Engines/TypesenseEngine.php +++ b/src/Engines/TypesenseEngine.php @@ -37,6 +37,11 @@ class TypesenseEngine extends Engine */ private int $groupByLimit = 3; + /** + * @var int|string + */ + private int|string $numTypos = 2; + /** * @var string */ @@ -253,6 +258,7 @@ private function buildSearchParams(Builder $builder, int $page, int|null $perPag 'enable_overrides' => $this->enableOverrides, 'highlight_affix_num_tokens' => $this->highlightAffixNumTokens, 'infix' => $this->infix, + 'num_typos' => $this->numTypos, ]; if ($this->limitHits > 0) { @@ -364,6 +370,7 @@ private function parseOrderBy(array $orders): string */ protected function performSearch(Builder $builder, array $options = []): mixed { + $options = array_merge($options, $builder->options); // newly added line $documents = $this->typesense->getCollectionIndex($builder->model) ->getDocuments(); if ($builder->callback) {