From 284d822a8a2884e0bd70772f2e854a95c811c004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 5 Jan 2018 17:29:59 +0100 Subject: [PATCH] Asset search: order by newest-first on empty query --- pillar/api/search/queries.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pillar/api/search/queries.py b/pillar/api/search/queries.py index 52d6209f..09f16947 100644 --- a/pillar/api/search/queries.py +++ b/pillar/api/search/queries.py @@ -77,6 +77,8 @@ def do_node_search(query: str, terms: dict) -> dict: should = [] search = nested_bool(must, should, terms, index_alias='NODE') + if not query: + search = search.sort('-created_at') add_aggs_to_search(search, NODE_AGG_TERMS) if log.isEnabledFor(logging.DEBUG):