From c05fcbf4c07b108300b78ed2dc70cbb98bb1153f Mon Sep 17 00:00:00 2001 From: Alex Rabinovich <4alexr@gmail.com> Date: Mon, 5 Nov 2018 18:51:13 +0200 Subject: [PATCH] Update SearchableTrait.php threshold should be divided by total number of columns in order to keep the spread and relevance. this is important when there are a lot of columns in the select query (or a very big table with a lot of columns). @nicolaslopezj please accept this PR. --- src/SearchableTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SearchableTrait.php b/src/SearchableTrait.php index aa9ac01..e8b8ed3 100644 --- a/src/SearchableTrait.php +++ b/src/SearchableTrait.php @@ -85,7 +85,7 @@ public function scopeSearchRestricted(Builder $q, $search, $restriction, $thresh // Default the threshold if no value was passed. if (is_null($threshold)) { - $threshold = $relevance_count / 4; + $threshold = $relevance_count / count($this->getColumns()); } if (!empty($selects)) {