Skip to content

Commit

Permalink
Merge pull request #6 from vblinden/empty-search
Browse files Browse the repository at this point in the history
Allow empty search
  • Loading branch information
bbrala authored May 14, 2018
2 parents b141eaf + a611892 commit 7c9c71a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ public function runForClass($search, $class){
* @return \Illuminate\Database\Eloquent\Builder
*/
public function searchQuery($search) {
$terms = TermBuilder::terms($search);
$termsBool = '';
$termsMatch = '';

$termsMatch = ''.$terms->implode(' ');
$termsBool = '+'.$terms->implode(' +');
if ($search) {
$terms = TermBuilder::terms($search);

$termsBool = '+'.$terms->implode(' +');
$termsMatch = ''.$terms->implode(' ');
}

$titleWeight = str_replace(',', '.', (float)config('laravel-fulltext.weight.title', 1.5));
$contentWeight = str_replace(',', '.', (float)config('laravel-fulltext.weight.content', 1.0));
Expand Down

0 comments on commit 7c9c71a

Please sign in to comment.