Skip to content

Commit

Permalink
Merge pull request #226 from ViliusS/enhance-boolean-search
Browse files Browse the repository at this point in the history
Enhance boolean search expression.
  • Loading branch information
nticaric authored Nov 12, 2020
2 parents 558d49d + 6b983c7 commit 5684986
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Support/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function priority($operator)

public function lex($string)
{
$bad = [' or ', '-', ' ', '@', '.'];
$good = [ '|' , '~', '&', '&', '&'];
$bad = [' or ', ' -', ' '];
$good = ['|', '~', '&'];

$string = str_replace($bad, $good, $string);
$string = mb_strtolower($string);
Expand Down
1 change: 0 additions & 1 deletion tests/support/ExpressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public function testToPostfix()
$this->assertEquals(['great', 'awsome', '|'], $exp->toPostfix("great or awsome"));
$this->assertEquals(['great', 'awsome', '&'], $exp->toPostfix("great awsome"));
$this->assertEquals(['email', 'test', '&', 'com', '&'], $exp->toPostfix("email test com"));
$this->assertEquals(['email', 'test', '&', 'com', '&'], $exp->toPostfix("[email protected]"));
$this->assertEquals(['first', 'last', '&', 'something', 'else', '&', '|'], $exp->toPostfix("(first last) or (something else)"));
}
}

0 comments on commit 5684986

Please sign in to comment.