Skip to content

Commit

Permalink
refactor: only set limit when limit is bigger than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocksheep committed Nov 15, 2024
1 parent 665de6b commit 4fddbd2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4fddbd2

Please sign in to comment.