From 0e097a586727d9032cbb292e1ea79311dedde8a0 Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 18 Sep 2012 14:09:47 -0700 Subject: [PATCH] Sort elasticsearch results by date created Summary: Similar to MySQL search. Test Plan: Displayed Edit Dependencies dialog on revision. Reviewers: epriestley, btrahan Reviewed By: btrahan CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3519 --- .../search/engine/PhabricatorSearchEngineElastic.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/applications/search/engine/PhabricatorSearchEngineElastic.php b/src/applications/search/engine/PhabricatorSearchEngineElastic.php index be0cf71653..beada59da5 100644 --- a/src/applications/search/engine/PhabricatorSearchEngineElastic.php +++ b/src/applications/search/engine/PhabricatorSearchEngineElastic.php @@ -16,6 +16,9 @@ * limitations under the License. */ +/** + * @group search + */ final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine { private $uri; private $timeout; @@ -177,6 +180,12 @@ final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine { } } + if (!$query->getQuery()) { + $spec['sort'] = array( + array('dateCreated' => 'desc'), + ); + } + $spec['from'] = (int)$query->getParameter('offset', 0); $spec['size'] = (int)$query->getParameter('limit', 25);