mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-22 11:56:21 +03:00
fix: search scoring
This commit is contained in:
parent
2317dd6fdc
commit
e042e0bc76
1 changed files with 3 additions and 1 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue