Added "sort:" keyword in search

This commit is contained in:
Marcin Kurczewski 2014-05-13 21:46:46 +02:00
parent a99e0d93f0
commit 186a680e98
2 changed files with 9 additions and 1 deletions

View file

@ -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);
} }

View file

@ -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');