Fixed scoremin and scoremax

This commit is contained in:
Marcin Kurczewski 2014-11-17 23:04:23 +01:00
parent 6a751ed0b2
commit 2996f27671

View file

@ -43,12 +43,16 @@ class PostSearchParser extends AbstractSearchParser
$tokenKey = $token->getKey(); $tokenKey = $token->getKey();
$tokenValue = $token->getValue(); $tokenValue = $token->getValue();
if ($this->matches($tokenKey, ['tag_min', 'tag_max', 'fav_min', 'fav_max', 'score_min', 'score_max'])) $countAliases = ['tag_count' => 'tag', 'fav_count' => 'fav', 'score' => 'score'];
foreach ($countAliases as $realKey => $baseAlias)
{ {
$token = new NamedSearchToken(); if ($this->matches($tokenKey, [$baseAlias . '_min', $baseAlias . '_max']))
$token->setKey(str_replace('__', '_', str_replace(['min', 'max'], '_count', $tokenKey))); {
$token->setValue(strpos($tokenKey, 'min') !== false ? $tokenValue . '..' : '..' . $tokenValue); $token = new NamedSearchToken();
return $this->decorateFilterFromNamedToken($filter, $token); $token->setKey($realKey);
$token->setValue(strpos($tokenKey, 'min') !== false ? $tokenValue . '..' : '..' . $tokenValue);
return $this->decorateFilterFromNamedToken($filter, $token);
}
} }
$map = $map =