From 56ae4a41ebeadbb17feb1572b9464af6d9b8098a Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 4 Dec 2020 11:27:51 -0800 Subject: [PATCH] Emoji completion: reverse results to show higher results at the top --- ts/components/emoji/lib.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/components/emoji/lib.ts b/ts/components/emoji/lib.ts index 4cae1d9c9f..04c484247c 100644 --- a/ts/components/emoji/lib.ts +++ b/ts/components/emoji/lib.ts @@ -219,7 +219,8 @@ const fuse = new Fuse(data, { }); export function search(query: string, count = 0): Array { - const results = fuse.search(query.substr(0, 32)); + // We reverse it because fuse returns low-score results first! + const results = fuse.search(query.substr(0, 32)).reverse(); if (count) { return take(results, count);