Added uploader: support to post searching
This commit is contained in:
parent
11931075f5
commit
0cfb7b821d
4 changed files with 18 additions and 1 deletions
1
TODO
1
TODO
|
@ -11,7 +11,6 @@ everything related to posts:
|
||||||
- add warning if no posts were found
|
- add warning if no posts were found
|
||||||
- search filters
|
- search filters
|
||||||
- safety:safe/sketchy/unsafe
|
- safety:safe/sketchy/unsafe
|
||||||
- submit:rr-
|
|
||||||
- comment:rr-
|
- comment:rr-
|
||||||
- comment_count: 3..5
|
- comment_count: 3..5
|
||||||
- fav:rr-
|
- fav:rr-
|
||||||
|
|
|
@ -110,6 +110,11 @@ class PostDao extends AbstractDao implements ICrudDao
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elseif ($requirement->getType() === \Szurubooru\SearchServices\Filters\PostFilter::REQUIREMENT_UPLOADER)
|
||||||
|
{
|
||||||
|
$query->innerJoin('users uploader ON uploader.id = userId');
|
||||||
|
}
|
||||||
|
|
||||||
parent::decorateQueryFromRequirement($query, $requirement);
|
parent::decorateQueryFromRequirement($query, $requirement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ class PostFilter extends BasicFilter implements IFilter
|
||||||
const REQUIREMENT_TAG_COUNT = 'tagCount';
|
const REQUIREMENT_TAG_COUNT = 'tagCount';
|
||||||
const REQUIREMENT_FAV_COUNT = 'favCount';
|
const REQUIREMENT_FAV_COUNT = 'favCount';
|
||||||
const REQUIREMENT_SCORE = 'score';
|
const REQUIREMENT_SCORE = 'score';
|
||||||
|
const REQUIREMENT_UPLOADER = 'uploader.name';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,9 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
elseif ($token->getKey() === 'score')
|
elseif ($token->getKey() === 'score')
|
||||||
$this->addScoreRequirement($filter, $token);
|
$this->addScoreRequirement($filter, $token);
|
||||||
|
|
||||||
|
elseif ($token->getKey() === 'uploader')
|
||||||
|
$this->addUploaderRequirement($filter, $token);
|
||||||
|
|
||||||
else
|
else
|
||||||
throw new \BadMethodCallException('Not supported');
|
throw new \BadMethodCallException('Not supported');
|
||||||
}
|
}
|
||||||
|
@ -138,6 +141,15 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
self::ALLOW_COMPOSITE | self::ALLOW_RANGES);
|
self::ALLOW_COMPOSITE | self::ALLOW_RANGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function addUploaderRequirement($filter, $token)
|
||||||
|
{
|
||||||
|
$this->addRequirementFromToken(
|
||||||
|
$filter,
|
||||||
|
$token,
|
||||||
|
\Szurubooru\SearchServices\Filters\PostFilter::REQUIREMENT_UPLOADER,
|
||||||
|
self::ALLOW_COMPOSITE);
|
||||||
|
}
|
||||||
|
|
||||||
private function dateToTime($value)
|
private function dateToTime($value)
|
||||||
{
|
{
|
||||||
$value = strtolower(trim($value));
|
$value = strtolower(trim($value));
|
||||||
|
|
Loading…
Reference in a new issue