chore: search cleanup
This commit is contained in:
parent
2cd835d31b
commit
55286f8c3b
3 changed files with 7 additions and 8 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "1.5.10",
|
"version": "1.5.11",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "1.5.10",
|
"version": "1.5.11",
|
||||||
"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.10",
|
"version": "1.5.11",
|
||||||
"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": {
|
||||||
|
|
|
@ -109,9 +109,8 @@ window.addEventListener("load", () => {
|
||||||
searchOptions: {
|
searchOptions: {
|
||||||
fields: ["title", "tags"],
|
fields: ["title", "tags"],
|
||||||
prefix: true,
|
prefix: true,
|
||||||
fuzzy: 0,
|
fuzzy: 0.1,
|
||||||
boost: { title: 2, tags: 1.5 },
|
boost: { title: 3, tags: 1.5 },
|
||||||
sort: (a, b) => b.score - a.score,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const $form = document.querySelector(".search__form");
|
const $form = document.querySelector(".search__form");
|
||||||
|
@ -214,7 +213,7 @@ window.addEventListener("load", () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://coryd.dev/api/search?q=${query}&type=${typeQuery}&page=${page}&pageSize=${PAGE_SIZE}`
|
`https://localhost:8787/api/search?q=${query}&type=${typeQuery}&page=${page}&pageSize=${PAGE_SIZE}`
|
||||||
);
|
);
|
||||||
const index = await response.json();
|
const index = await response.json();
|
||||||
const results = index.results || [];
|
const results = index.results || [];
|
||||||
|
@ -297,4 +296,4 @@ window.addEventListener("load", () => {
|
||||||
updateSearchResults(nextResults);
|
updateSearchResults(nextResults);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
});
|
});
|
Reference in a new issue