From e0ced89a9b968279512f8e53fd75a06a99e38a87 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 30 Sep 2014 14:53:40 +0200 Subject: [PATCH] Added order:tag_count 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 949dcce1..64fc778a 100644 --- a/TODO +++ b/TODO @@ -29,7 +29,6 @@ everything related to posts: - order:time - order:score - order:comment_count - - order:tag_count - order:comment_time - order:file_size - order:random (at least unstable version) diff --git a/src/SearchServices/Filters/PostFilter.php b/src/SearchServices/Filters/PostFilter.php index 9f9b62b4..c610cac7 100644 --- a/src/SearchServices/Filters/PostFilter.php +++ b/src/SearchServices/Filters/PostFilter.php @@ -5,6 +5,7 @@ class PostFilter extends BasicFilter implements IFilter { const ORDER_FAV_TIME = 'lastFavTime'; const ORDER_FAV_COUNT = 'favCount'; + const ORDER_TAG_COUNT = 'tagCount'; const REQUIREMENT_TAG = 'tag'; const REQUIREMENT_ID = 'id'; diff --git a/src/SearchServices/Parsers/PostSearchParser.php b/src/SearchServices/Parsers/PostSearchParser.php index 545cd76b..a19a3cd9 100644 --- a/src/SearchServices/Parsers/PostSearchParser.php +++ b/src/SearchServices/Parsers/PostSearchParser.php @@ -40,6 +40,9 @@ class PostSearchParser extends AbstractSearchParser elseif ($token === 'fav_count') return \Szurubooru\SearchServices\Filters\PostFilter::ORDER_FAV_COUNT; + elseif ($token === 'tag_count') + return \Szurubooru\SearchServices\Filters\PostFilter::ORDER_TAG_COUNT; + throw new \BadMethodCallException('Not supported'); }