Emoji: Search on short name first, eliminate short_names, proper sort
This commit is contained in:
parent
c87ffcd2e9
commit
25f64a5140
1 changed files with 2 additions and 3 deletions
|
@ -215,12 +215,11 @@ const fuse = new Fuse(data, {
|
|||
minMatchCharLength: 1,
|
||||
tokenize: true,
|
||||
tokenSeparator: /[-_\s]+/,
|
||||
keys: ['name', 'short_name', 'short_names'],
|
||||
keys: ['short_name', 'name'],
|
||||
});
|
||||
|
||||
export function search(query: string, count = 0): Array<EmojiData> {
|
||||
// We reverse it because fuse returns low-score results first!
|
||||
const results = fuse.search(query.substr(0, 32)).reverse();
|
||||
const results = fuse.search(query.substr(0, 32));
|
||||
|
||||
if (count) {
|
||||
return take(results, count);
|
||||
|
|
Loading…
Add table
Reference in a new issue