From ac1997d4d03238c6d65671d2eaf2a37d11601c00 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 1 Feb 2014 09:53:32 +0100 Subject: [PATCH] Refactored search case sensitivity support --- src/Models/SearchServices/PostSearchService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Models/SearchServices/PostSearchService.php b/src/Models/SearchServices/PostSearchService.php index 40e03741..17b11619 100644 --- a/src/Models/SearchServices/PostSearchService.php +++ b/src/Models/SearchServices/PostSearchService.php @@ -108,7 +108,7 @@ class PostSearchService extends AbstractSearchService { $context = \Chibi\Registry::getContext(); - switch (strtolower($val)) + switch ($val) { case 'liked': case 'likes': @@ -147,7 +147,7 @@ class PostSearchService extends AbstractSearchService protected static function filterTokenType($searchContext, SqlQuery $sqlQuery, $val) { - switch (strtolower($val)) + switch ($val) { case 'swf': $type = PostType::Flash; @@ -391,7 +391,7 @@ class PostSearchService extends AbstractSearchService } else { - $key = strtolower(substr($token, 0, $pos)); + $key = substr($token, 0, $pos); $val = substr($token, $pos + 1); } @@ -413,7 +413,7 @@ class PostSearchService extends AbstractSearchService self::filterUserSafety($sqlQuery); /* query tokens */ - $tokens = array_filter(array_unique(explode(' ', $searchQuery)), function($x) { return $x != ''; }); + $tokens = array_filter(array_unique(explode(' ', strtolower($searchQuery)))); if (self::$enableTokenLimit and count($tokens) > $config->browsing->maxSearchTokens) throw new SimpleException('Too many search tokens (maximum: ' . $config->browsing->maxSearchTokens . ')');