fix: search scoring

This commit is contained in:
Artemy 2023-04-06 17:31:28 +03:00
parent 2317dd6fdc
commit e042e0bc76

View file

@ -22,6 +22,8 @@ function Notes() {
let n = Object.values(localStorage.getObj("Notes")); let n = Object.values(localStorage.getObj("Notes"));
let fuse = new Fuse(n, { let fuse = new Fuse(n, {
includeScore: true,
useExtendedSearch: true,
keys: ["name", "text", "textTime", "tags"], keys: ["name", "text", "textTime", "tags"],
}); });
@ -32,7 +34,7 @@ function Notes() {
if (search !== "") { if (search !== "") {
found = found found = found
.sort((a, b) => { .sort((a, b) => {
return b.refIndex - a.refIndex; return a.score - b.score;
}) })
.map(({ item }) => item); .map(({ item }) => item);
} else { } else {