Added ability to search tags by usage count

This commit is contained in:
rr- 2015-11-24 21:56:27 +01:00
parent 96195f0efc
commit b3c5212c84
2 changed files with 11 additions and 0 deletions

View file

@ -13,6 +13,7 @@ class TagFilter extends BasicFilter implements IFilter
const REQUIREMENT_CREATION_TIME = 'creationTime';
const REQUIREMENT_LAST_EDIT_TIME = 'lastEditTime';
const REQUIREMENT_CATEGORY = 'category';
const REQUIREMENT_USAGE_COUNT = 'usages';
public function __construct()
{

View file

@ -40,6 +40,16 @@ class TagSearchParser extends AbstractSearchParser
return;
}
if ($this->matches($token->getKey(), ['usage_count', 'usages', 'usage']))
{
$this->addRequirementFromToken(
$filter,
$token,
TagFilter::REQUIREMENT_USAGE_COUNT,
self::ALLOW_RANGES | self::ALLOW_COMPOSITE);
return;
}
if ($this->matches($token->getKey(), ['category']))
{
$this->addRequirementFromToken(