Added image_{width,height,area} search order kinds

This commit is contained in:
rr- 2016-02-19 09:51:37 +01:00
parent 2bba57e8de
commit f49a8fabab
3 changed files with 12 additions and 3 deletions

View file

@ -176,6 +176,9 @@
{search: 'order:edit_date', description: 'like <code>creation_date</code>, only looks at last edit time'},
{search: 'order:score', description: 'highest scored'},
{search: 'order:file_size', description: 'largest files first'},
{search: 'order:image_width', description: 'widest images first'},
{search: 'order:image_height', description: 'tallest images first'},
{search: 'order:image_area', description: 'largest images first'},
{search: 'order:tag_count', description: 'with most tags'},
{search: 'order:fav_count', description: 'loved by most'},
{search: 'order:comment_count', description: 'most commented first'},

View file

@ -16,6 +16,9 @@ class PostFilter extends BasicFilter implements IFilter
const ORDER_LAST_FAV_TIME = 'posts.lastFavTime';
const ORDER_LAST_FEATURE_TIME = 'posts.lastFeatureTime';
const ORDER_FEATURE_COUNT = 'posts.featureCount';
const ORDER_IMAGE_WIDTH = 'posts.imageWidth';
const ORDER_IMAGE_HEIGHT = 'posts.imageHeight';
const ORDER_IMAGE_AREA = 'posts.imageWidth*posts.imageHeight';
const REQUIREMENT_TAG = 'posts.tag';
const REQUIREMENT_ID = 'posts.id';

View file

@ -39,6 +39,9 @@ class PostSearchParserConfig extends AbstractSearchParserConfig
$this->defineOrder(PostFilter::ORDER_LAST_COMMENT_TIME, ['comment_time', 'comment_date']);
$this->defineOrder(PostFilter::ORDER_LAST_FEATURE_TIME, ['feature_time', 'feature_date']);
$this->defineOrder(PostFilter::ORDER_FEATURE_COUNT, ['feature_count', 'features', 'featured']);
$this->defineOrder(PostFilter::ORDER_IMAGE_WIDTH, ['image_width', 'width']);
$this->defineOrder(PostFilter::ORDER_IMAGE_HEIGHT, ['image_height', 'height']);
$this->defineOrder(PostFilter::ORDER_IMAGE_AREA, ['image_area', 'area']);
$this->defineBasicTokenParser(
function(SearchToken $token)
@ -178,17 +181,17 @@ class PostSearchParserConfig extends AbstractSearchParserConfig
$this->defineNamedTokenParser(
PostFilter::REQUIREMENT_IMAGE_WIDTH,
['image_width', 'posts'],
['image_width', 'width'],
self::ALLOW_COMPOSITE | self::ALLOW_RANGE);
$this->defineNamedTokenParser(
PostFilter::REQUIREMENT_IMAGE_HEIGHT,
['image_height', 'posts'],
['image_height', 'height'],
self::ALLOW_COMPOSITE | self::ALLOW_RANGE);
$this->defineNamedTokenParser(
PostFilter::REQUIREMENT_IMAGE_AREA,
['image_area', 'posts'],
['image_area', 'area'],
self::ALLOW_COMPOSITE | self::ALLOW_RANGE);
}