Added file_size search syntax

This commit is contained in:
rr- 2016-02-19 09:53:26 +01:00
parent f49a8fabab
commit 87681f8c0d
3 changed files with 7 additions and 0 deletions

View file

@ -123,6 +123,7 @@
{search: 'date:2000-01-01', description: 'posted on January 1st, 2000'},
{search: 'id:1', description: 'having specific post ID'},
{search: 'name:<em>hash</em>', description: 'having specific post name (hash in full URLs)'},
{search: 'file_size:100..', description: 'having at least 100 bytes'},
{search: 'image_width:100..', description: 'being at least 100 pixels wide'},
{search: 'image_height:100..', description: 'being at least 100 pixels tall'},
{search: 'image_area:10000..', description: 'having at least 10000 pixels'},

View file

@ -38,6 +38,7 @@ class PostFilter extends BasicFilter implements IFilter
const REQUIREMENT_TYPE = 'posts.contentType';
const REQUIREMENT_USER_SCORE = 'posts.userScore';
const REQUIREMENT_TUMBLEWEED = 'tumbleweed';
const REQUIREMENT_FILE_SIZE = 'posts.originalFileSize';
const REQUIREMENT_IMAGE_WIDTH = 'posts.imageWidth';
const REQUIREMENT_IMAGE_HEIGHT = 'posts.imageHeight';
const REQUIREMENT_IMAGE_AREA = 'posts.imageWidth*posts.imageHeight';

View file

@ -179,6 +179,11 @@ class PostSearchParserConfig extends AbstractSearchParserConfig
return $requirement;
});
$this->defineNamedTokenParser(
PostFilter::REQUIREMENT_FILE_SIZE,
['file_size'],
self::ALLOW_COMPOSITE | self::ALLOW_RANGE);
$this->defineNamedTokenParser(
PostFilter::REQUIREMENT_IMAGE_WIDTH,
['image_width', 'width'],