Added "sort:" keyword in search
This commit is contained in:
parent
a99e0d93f0
commit
186a680e98
2 changed files with 9 additions and 1 deletions
|
@ -28,7 +28,7 @@ abstract class AbstractSearchParser
|
||||||
list ($key, $value) = explode(':', $token, 2);
|
list ($key, $value) = explode(':', $token, 2);
|
||||||
$key = strtolower($key);
|
$key = strtolower($key);
|
||||||
|
|
||||||
if ($key == 'order')
|
if ($key == 'order' or $key == 'sort')
|
||||||
{
|
{
|
||||||
$this->internalProcessOrderToken($value, $neg);
|
$this->internalProcessOrderToken($value, $neg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,6 +602,14 @@ class ListPostsJobTest extends AbstractTest
|
||||||
$this->testOrder('order:id', [$posts[2], $posts[1], $posts[0]]);
|
$this->testOrder('order:id', [$posts[2], $posts[1], $posts[0]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOrderByIdUsingAlternativeKeyword()
|
||||||
|
{
|
||||||
|
$this->grantAccess('listPosts');
|
||||||
|
$posts = $this->preparePostsWithTags();
|
||||||
|
|
||||||
|
$this->testOrder('sort:id', [$posts[2], $posts[1], $posts[0]]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testOrderByFavCount()
|
public function testOrderByFavCount()
|
||||||
{
|
{
|
||||||
$this->grantAccess('listPosts');
|
$this->grantAccess('listPosts');
|
||||||
|
|
Loading…
Reference in a new issue