From 9c1a028c81c100248a97d70f2d760dec06fc4d49 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 3 Oct 2014 19:37:19 +0200 Subject: [PATCH] Added order:file_size support to post searching --- TODO | 1 - src/SearchServices/Filters/PostFilter.php | 1 + src/SearchServices/Parsers/PostSearchParser.php | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index dbb874ae..0d818c75 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,6 @@ everything related to posts: - search order - order:comment_count - order:comment_time - - order:file_size - order:random (at least unstable version) - single post view diff --git a/src/SearchServices/Filters/PostFilter.php b/src/SearchServices/Filters/PostFilter.php index 6d7a50bd..a47e1a5f 100644 --- a/src/SearchServices/Filters/PostFilter.php +++ b/src/SearchServices/Filters/PostFilter.php @@ -9,6 +9,7 @@ class PostFilter extends BasicFilter implements IFilter const ORDER_TAG_COUNT = 'tagCount'; const ORDER_SCORE = 'score'; const ORDER_LAST_EDIT_TIME = 'lastEditTime'; + const ORDER_FILE_SIZE = 'originalFileSize'; const REQUIREMENT_TAG = 'tag'; const REQUIREMENT_ID = 'id'; diff --git a/src/SearchServices/Parsers/PostSearchParser.php b/src/SearchServices/Parsers/PostSearchParser.php index 285dc8b3..1326a7c5 100644 --- a/src/SearchServices/Parsers/PostSearchParser.php +++ b/src/SearchServices/Parsers/PostSearchParser.php @@ -94,6 +94,9 @@ class PostSearchParser extends AbstractSearchParser elseif ($token === 'score') return \Szurubooru\SearchServices\Filters\PostFilter::ORDER_SCORE; + elseif ($token === 'file_size') + return \Szurubooru\SearchServices\Filters\PostFilter::ORDER_FILE_SIZE; + throw new \BadMethodCallException('Not supported'); }