From e042e0bc76339574ac1ddc50ee56f331217b7340 Mon Sep 17 00:00:00 2001 From: Artemy Date: Thu, 6 Apr 2023 17:31:28 +0300 Subject: [PATCH] fix: search scoring --- src/pages/notes.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/notes.jsx b/src/pages/notes.jsx index 8a37489..8129cef 100644 --- a/src/pages/notes.jsx +++ b/src/pages/notes.jsx @@ -22,6 +22,8 @@ function Notes() { let n = Object.values(localStorage.getObj("Notes")); let fuse = new Fuse(n, { + includeScore: true, + useExtendedSearch: true, keys: ["name", "text", "textTime", "tags"], }); @@ -32,7 +34,7 @@ function Notes() { if (search !== "") { found = found .sort((a, b) => { - return b.refIndex - a.refIndex; + return a.score - b.score; }) .map(({ item }) => item); } else {