Skip to content

Commit

Permalink
Remove unused 'query' parameter in several methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rjorel committed Oct 24, 2019
1 parent 4cc77ef commit 90e3b63
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/SearchableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public function scopeSearchRestricted(Builder $q, $search, $restriction, $thresh
$relevance_count += $relevance;

if (!$entireTextOnly) {
$queries = $this->getSearchQueriesForColumn($query, $column, $relevance, $words);
$queries = $this->getSearchQueriesForColumn($column, $relevance, $words);
} else {
$queries = [];
}

if ( ($entireText === true && count($words) > 1) || $entireTextOnly === true )
{
$queries[] = $this->getSearchQuery($query, $column, $relevance, [$search], 50, '', '');
$queries[] = $this->getSearchQuery($query, $column, $relevance, [$search], 30, '%', '%');
$queries[] = $this->getSearchQuery($column, $relevance, [$search], 50, '', '');
$queries[] = $this->getSearchQuery($column, $relevance, [$search], 30, '%', '%');
}

foreach ($queries as $select)
Expand Down Expand Up @@ -257,27 +257,25 @@ protected function filterQueryWithRelevance(Builder $query, array $selects, $rel
/**
* Returns the search queries for the specified column.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $column
* @param float $relevance
* @param array $words
* @return array
*/
protected function getSearchQueriesForColumn(Builder $query, $column, $relevance, array $words)
protected function getSearchQueriesForColumn($column, $relevance, array $words)
{
$queries = [];

$queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 15);
$queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 5, '', '%');
$queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 1, '%', '%');
$queries[] = $this->getSearchQuery($column, $relevance, $words, 15);
$queries[] = $this->getSearchQuery($column, $relevance, $words, 5, '', '%');
$queries[] = $this->getSearchQuery($column, $relevance, $words, 1, '%', '%');

return $queries;
}

/**
* Returns the sql string for the given parameters.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $column
* @param string $relevance
* @param array $words
Expand All @@ -287,7 +285,7 @@ protected function getSearchQueriesForColumn(Builder $query, $column, $relevance
* @param string $post_word
* @return string
*/
protected function getSearchQuery(Builder $query, $column, $relevance, array $words, $relevance_multiplier, $pre_word = '', $post_word = '')
protected function getSearchQuery($column, $relevance, array $words, $relevance_multiplier, $pre_word = '', $post_word = '')
{
$like_comparator = $this->getDatabaseDriver() == 'pgsql' ? 'ILIKE' : 'LIKE';
$cases = [];
Expand Down

0 comments on commit 90e3b63

Please sign in to comment.