Skip to content

Commit

Permalink
Use table prefix when using orderByRelevance (protonemedia#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushargugnani authored Sep 20, 2022
1 parent f89baec commit 69fc11a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Searcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,9 @@ private function addRelevanceQueryToBuilder($builder, $modelToSearchThrough)
throw OrderByRelevanceException::new();
}

$expressionsAndBindings = $modelToSearchThrough->getQualifiedColumns()->flatMap(function ($field) {
$field = (new MySqlGrammar)->wrap($field);
$expressionsAndBindings = $modelToSearchThrough->getQualifiedColumns()->flatMap(function ($field) use ($modelToSearchThrough) {
$prefix = $modelToSearchThrough->getModel()->getConnection()->getTablePrefix();
$field = (new MySqlGrammar)->wrap($prefix . $field);

return $this->termsWithoutWildcards->map(function ($term) use ($field) {
return [
Expand Down

0 comments on commit 69fc11a

Please sign in to comment.