Skip to content

Commit

Permalink
handle case
Browse files Browse the repository at this point in the history
  • Loading branch information
nticaric committed May 27, 2016
1 parent b8db8fe commit d6b563d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Support/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public function lex($string)
$good = [ '|' , '~', '&', '&', '&'];

$string = str_replace($bad, $good, $string);

$string = strtolower($string);

$tokens = [];
$token = "";
foreach (str_split($string) as $char) {
Expand Down
2 changes: 1 addition & 1 deletion src/TNTSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function info($str)
public function breakIntoTokens($text)
{
$indexer = new TNTIndexer;
return $indexer->breakIntoTokens($text);
return $indexer->breakIntoTokens(strtolower($text));
}

public function highlight($text, $needle, $tag = 'em', $options = [])
Expand Down
6 changes: 6 additions & 0 deletions tests/TNTSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public function testSearchBoolean()

$res = $tnt->searchBoolean('hamlet');
$this->assertEquals([1,2], $res['ids']);

$res = $tnt->searchBoolean('eldred -bar');
$this->assertEquals([11], $res['ids']);

$res = $tnt->searchBoolean('Eldred -bar');
$this->assertEquals([11], $res['ids']);
}

public function testIndexUpdate()
Expand Down
Binary file modified tests/_files/articles.sqlite
Binary file not shown.

0 comments on commit d6b563d

Please sign in to comment.