Skip to content

Commit

Permalink
Merge pull request #53 from JulienTant/patch-2
Browse files Browse the repository at this point in the history
Add the possibility to search for the whole text
  • Loading branch information
nicolaslopezj committed May 12, 2015
2 parents 0f6fe9f + 387037a commit 81b5478
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/SearchableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait SearchableTrait
* @param float|null $threshold
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeSearch(Builder $q, $search, $threshold = null)
public function scopeSearch(Builder $q, $search, $threshold = null, $entireText = false)
{
$query = clone $q;
$query->select($this->getTable() . '.*');
Expand All @@ -38,6 +38,12 @@ public function scopeSearch(Builder $q, $search, $threshold = null)

$search = strtolower($search);
$words = explode(' ', $search);
if ( $entireText === true )
{
array_unshift($words, $search);
}


$selects = [];
$this->search_bindings = [];
$relevance_count = 0;
Expand Down

0 comments on commit 81b5478

Please sign in to comment.