From af69b4fa58c9eef4a0585385762400f113d5f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 5 Jan 2018 16:02:49 +0100 Subject: [PATCH] Admin user search: boost user ID matching --- pillar/api/search/queries.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pillar/api/search/queries.py b/pillar/api/search/queries.py index 527f9d8b..6ece0114 100644 --- a/pillar/api/search/queries.py +++ b/pillar/api/search/queries.py @@ -129,7 +129,12 @@ def do_user_search_admin(query: str) -> dict: # We most likely got and id field. we should find it. if len(query) == len('563aca02c379cf0005e8e17d'): - should.append(Q('term', objectID=query)) + should.append({'term': { + 'objectID': { + 'value': query, # the thing we're looking for + 'boost': 100, # how much more it counts for the score + } + }}) search = Search(using=client) search.query = Q('bool', should=should)