Skip to content

Commit

Permalink
Update SearchableTrait.php
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
putchi authored Nov 5, 2018
1 parent cfd888b commit c05fcbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SearchableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit c05fcbf

Please sign in to comment.