chore: search cleanup
This commit is contained in:
parent
947affa2ab
commit
19d17f70d2
3 changed files with 4 additions and 13 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "1.5.15",
|
"version": "1.5.16",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "1.5.15",
|
"version": "1.5.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cdransf/api-text": "^1.5.0",
|
"@cdransf/api-text": "^1.5.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "1.5.15",
|
"version": "1.5.16",
|
||||||
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -110,16 +110,7 @@ window.addEventListener("load", () => {
|
||||||
fields: ["title", "tags"],
|
fields: ["title", "tags"],
|
||||||
prefix: true,
|
prefix: true,
|
||||||
fuzzy: 0.1,
|
fuzzy: 0.1,
|
||||||
boost: { title: 5, tags: 2 },
|
boost: { title: 5, tags: 2, description: 1 },
|
||||||
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;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const $form = document.querySelector(".search__form");
|
const $form = document.querySelector(".search__form");
|
||||||
|
|
Reference in a new issue