Refactored search case sensitivity support
This commit is contained in:
parent
d085ffe39a
commit
ac1997d4d0
1 changed files with 4 additions and 4 deletions
|
@ -108,7 +108,7 @@ class PostSearchService extends AbstractSearchService
|
||||||
{
|
{
|
||||||
$context = \Chibi\Registry::getContext();
|
$context = \Chibi\Registry::getContext();
|
||||||
|
|
||||||
switch (strtolower($val))
|
switch ($val)
|
||||||
{
|
{
|
||||||
case 'liked':
|
case 'liked':
|
||||||
case 'likes':
|
case 'likes':
|
||||||
|
@ -147,7 +147,7 @@ class PostSearchService extends AbstractSearchService
|
||||||
|
|
||||||
protected static function filterTokenType($searchContext, SqlQuery $sqlQuery, $val)
|
protected static function filterTokenType($searchContext, SqlQuery $sqlQuery, $val)
|
||||||
{
|
{
|
||||||
switch (strtolower($val))
|
switch ($val)
|
||||||
{
|
{
|
||||||
case 'swf':
|
case 'swf':
|
||||||
$type = PostType::Flash;
|
$type = PostType::Flash;
|
||||||
|
@ -391,7 +391,7 @@ class PostSearchService extends AbstractSearchService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$key = strtolower(substr($token, 0, $pos));
|
$key = substr($token, 0, $pos);
|
||||||
$val = substr($token, $pos + 1);
|
$val = substr($token, $pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ class PostSearchService extends AbstractSearchService
|
||||||
self::filterUserSafety($sqlQuery);
|
self::filterUserSafety($sqlQuery);
|
||||||
|
|
||||||
/* query tokens */
|
/* 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)
|
if (self::$enableTokenLimit and count($tokens) > $config->browsing->maxSearchTokens)
|
||||||
throw new SimpleException('Too many search tokens (maximum: ' . $config->browsing->maxSearchTokens . ')');
|
throw new SimpleException('Too many search tokens (maximum: ' . $config->browsing->maxSearchTokens . ')');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue