Added a few search aliases
Each of "idmin", "datemax" etc got "id_min", "date_max" variant alias. Additionally, "id" got new "ids" alias.
This commit is contained in:
parent
5827626deb
commit
4455284bdb
1 changed files with 13 additions and 13 deletions
|
@ -54,7 +54,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
|
|
||||||
protected static function getCriterionForComplexToken($key, $value)
|
protected static function getCriterionForComplexToken($key, $value)
|
||||||
{
|
{
|
||||||
if (in_array($key, ['id']))
|
if (in_array($key, ['id', 'ids']))
|
||||||
{
|
{
|
||||||
$ids = preg_split('/[;,]/', $value);
|
$ids = preg_split('/[;,]/', $value);
|
||||||
$ids = array_map('intval', $ids);
|
$ids = array_map('intval', $ids);
|
||||||
|
@ -89,43 +89,43 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
return new SqlEqualsOperator('uploader_id', new SqlBinding($user->id));
|
return new SqlEqualsOperator('uploader_id', new SqlBinding($user->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif (in_array($key, ['idmin']))
|
elseif (in_array($key, ['idmin', 'id_min']))
|
||||||
return new SqlEqualsOrGreaterOperator('id', new SqlBinding(intval($value)));
|
return new SqlEqualsOrGreaterOperator('id', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['idmax']))
|
elseif (in_array($key, ['idmax', 'id_max']))
|
||||||
return new SqlEqualsOrLesserOperator('id', new SqlBinding(intval($value)));
|
return new SqlEqualsOrLesserOperator('id', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['scoremin']))
|
elseif (in_array($key, ['scoremin', 'score_min']))
|
||||||
return new SqlEqualsOrGreaterOperator('score', new SqlBinding(intval($value)));
|
return new SqlEqualsOrGreaterOperator('score', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['scoremax']))
|
elseif (in_array($key, ['scoremax', 'score_max']))
|
||||||
return new SqlEqualsOrLesserOperator('score', new SqlBinding(intval($value)));
|
return new SqlEqualsOrLesserOperator('score', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['tagmin']))
|
elseif (in_array($key, ['tagmin', 'tag_min']))
|
||||||
return new SqlEqualsOrGreaterOperator('tag_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrGreaterOperator('tag_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['tagmax']))
|
elseif (in_array($key, ['tagmax', 'tag_max']))
|
||||||
return new SqlEqualsOrLesserOperator('tag_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrLesserOperator('tag_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['favmin']))
|
elseif (in_array($key, ['favmin', 'fav_min']))
|
||||||
return new SqlEqualsOrGreaterOperator('fav_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrGreaterOperator('fav_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['favmax']))
|
elseif (in_array($key, ['favmax', 'fav_max']))
|
||||||
return new SqlEqualsOrLesserOperator('fav_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrLesserOperator('fav_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['commentmin']))
|
elseif (in_array($key, ['commentmin', 'comment_min']))
|
||||||
return new SqlEqualsOrGreaterOperator('comment_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrGreaterOperator('comment_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['commentmax']))
|
elseif (in_array($key, ['commentmax', 'comment_max']))
|
||||||
return new SqlEqualsOrLesserOperator('comment_count', new SqlBinding(intval($value)));
|
return new SqlEqualsOrLesserOperator('comment_count', new SqlBinding(intval($value)));
|
||||||
|
|
||||||
elseif (in_array($key, ['datemin', 'date']))
|
elseif (in_array($key, ['datemin', 'date_min', 'date']))
|
||||||
{
|
{
|
||||||
list ($dateMin, $dateMax) = self::parseDate($value);
|
list ($dateMin, $dateMax) = self::parseDate($value);
|
||||||
return new SqlEqualsOrGreaterOperator('upload_date', new SqlBinding($dateMin));
|
return new SqlEqualsOrGreaterOperator('upload_date', new SqlBinding($dateMin));
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif (in_array($key, ['datemax', 'date']))
|
elseif (in_array($key, ['datemax', 'date_max', 'date']))
|
||||||
{
|
{
|
||||||
list ($dateMin, $dateMax) = self::parseDate($value);
|
list ($dateMin, $dateMax) = self::parseDate($value);
|
||||||
return new SqlEqualsOrLesserOperator('upload_date', new SqlBinding($dateMax));
|
return new SqlEqualsOrLesserOperator('upload_date', new SqlBinding($dateMax));
|
||||||
|
|
Loading…
Reference in a new issue