chore: search cleanup

This commit is contained in:
Cory Dransfeldt 2024-10-19 20:32:54 -07:00
parent 947affa2ab
commit 19d17f70d2
No known key found for this signature in database
3 changed files with 4 additions and 13 deletions

View file

@ -110,16 +110,7 @@ window.addEventListener("load", () => {
fields: ["title", "tags"],
prefix: true,
fuzzy: 0.1,
boost: { title: 5, tags: 2 },
sort: (a, b) => {
const exactMatchA =
a.title.toLowerCase() === $input.value.trim().toLowerCase();
const exactMatchB =
b.title.toLowerCase() === $input.value.trim().toLowerCase();
if (exactMatchA && !exactMatchB) return -1;
if (!exactMatchA && exactMatchB) return 1;
return b.score - a.score;
},
boost: { title: 5, tags: 2, description: 1 },
},
});
const $form = document.querySelector(".search__form");