Skip to content

Commit 25f64a5

Browse files
Emoji: Search on short name first, eliminate short_names, proper sort
1 parent c87ffcd commit 25f64a5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ts/components/emoji/lib.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,11 @@ const fuse = new Fuse(data, {
215215
minMatchCharLength: 1,
216216
tokenize: true,
217217
tokenSeparator: /[-_\s]+/,
218-
keys: ['name', 'short_name', 'short_names'],
218+
keys: ['short_name', 'name'],
219219
});
220220

221221
export function search(query: string, count = 0): Array<EmojiData> {
222-
// We reverse it because fuse returns low-score results first!
223-
const results = fuse.search(query.substr(0, 32)).reverse();
222+
const results = fuse.search(query.substr(0, 32));
224223

225224
if (count) {
226225
return take(results, count);

0 commit comments

Comments
 (0)