From 4fddbd2d1f2058d87ae13b3702ad79da189db8c1 Mon Sep 17 00:00:00 2001 From: marinusvanvelzen Date: Fri, 15 Nov 2024 17:36:06 +0100 Subject: [PATCH] refactor: only set limit when limit is bigger than 0 --- src/Search.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Search.php b/src/Search.php index 3a94c5d..7b4d2b4 100644 --- a/src/Search.php +++ b/src/Search.php @@ -49,8 +49,12 @@ public function searchQuery(string $search): Builder '('.$titleWeight.' * (MATCH (indexed_title) AGAINST (?)) + '.$contentWeight.' * (MATCH (indexed_title, indexed_content) AGAINST (?)) ) DESC', - [$termsMatch, $termsMatch]) - ->limit(Config::integer('laravel-fulltext.limit-results')); + [$termsMatch, $termsMatch]); + + $limit = Config::integer('laravel-fulltext.limit'); + if ($limit > 0) { + $query->limit($limit); + } if (Config::boolean('laravel-fulltext.exclude_feature_enabled')) { $query->with(['indexable' => function ($query) {