Fixed duplicate and missing search orders

This commit is contained in:
Marcin Kurczewski 2014-10-12 10:43:42 +02:00
parent fadd37fe84
commit 5187d3a788
2 changed files with 17 additions and 17 deletions

View file

@ -4,9 +4,9 @@ namespace Szurubooru\SearchServices\Filters;
class PostFilter extends BasicFilter implements IFilter
{
const ORDER_ID = 'id';
const ORDER_FAV_TIME = 'lastFavTime';
const ORDER_FAV_COUNT = 'favCount';
const ORDER_TAG_COUNT = 'tagCount';
const ORDER_COMMENT_COUNT = 'commentCount';
const ORDER_SCORE = 'score';
const ORDER_LAST_EDIT_TIME = 'lastEditTime';
const ORDER_FILE_SIZE = 'originalFileSize';

View file

@ -103,18 +103,12 @@ class PostSearchParser extends AbstractSearchParser
protected function getOrderColumn($tokenText)
{
if ($tokenText === 'id')
if ($tokenText === 'random')
return PostFilter::ORDER_RANDOM;
elseif ($tokenText === 'id')
return PostFilter::ORDER_ID;
elseif ($tokenText === 'fav_time')
return PostFilter::ORDER_FAV_TIME;
elseif ($tokenText === 'fav_count')
return PostFilter::ORDER_FAV_COUNT;
elseif ($tokenText === 'tag_count')
return PostFilter::ORDER_TAG_COUNT;
elseif ($tokenText === 'time')
return PostFilter::ORDER_LAST_EDIT_TIME;
@ -124,17 +118,23 @@ class PostSearchParser extends AbstractSearchParser
elseif ($tokenText === 'file_size')
return PostFilter::ORDER_FILE_SIZE;
elseif ($tokenText === 'random')
return PostFilter::ORDER_RANDOM;
elseif ($tokenText === 'tag_count')
return PostFilter::ORDER_TAG_COUNT;
elseif ($tokenText === 'feature_time')
return PostFilter::ORDER_LAST_FEATURE_TIME;
elseif ($tokenText === 'fav_count')
return PostFilter::ORDER_FAV_COUNT;
elseif ($tokenText === 'comment_count')
return PostFilter::ORDER_COMMENT_COUNT;
elseif ($tokenText === 'fav_time')
return PostFilter::ORDER_LAST_FAV_TIME;
elseif ($tokenText === 'comment_time')
return PostFilter::ORDER_LAST_COMMENT_TIME;
elseif ($tokenText === 'fav_time')
return PostFilter::ORDER_LAST_FAV_TIME;
elseif ($tokenText === 'feature_time')
return PostFilter::ORDER_LAST_FEATURE_TIME;
else
throw new NotSupportedException();