diff --git a/src/lib/build_index.ts b/src/lib/build_index.ts index cbd45f12..6e7642ae 100644 --- a/src/lib/build_index.ts +++ b/src/lib/build_index.ts @@ -70,7 +70,7 @@ export async function buildAndCacheSearchIndex() { } fs.writeFileSync( - path.resolve("./.svelte-kit/output/client/search/api"), + path.resolve("./.svelte-kit/output/client/search/api.json"), JSON.stringify(data), ) console.log("Search index built") diff --git a/src/routes/(marketing)/search/+page.svelte b/src/routes/(marketing)/search/+page.svelte index ae6a85de..775b98e0 100644 --- a/src/routes/(marketing)/search/+page.svelte +++ b/src/routes/(marketing)/search/+page.svelte @@ -7,7 +7,11 @@ import { dev } from "$app/environment" const fuseOptions = { - keys: ["title", "description", "body"], + keys: [ + { name: "title", weight: 3 }, + { name: "description", weight: 2 }, + { name: "body", weight: 1 }, + ], ignoreLocation: true, threshold: 0.3, } @@ -18,7 +22,7 @@ let error = false onMount(async () => { try { - const response = await fetch("/search/api") + const response = await fetch("/search/api.json") if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`) } diff --git a/src/routes/(marketing)/search/api/+server.ts b/src/routes/(marketing)/search/api.json/+server.ts similarity index 100% rename from src/routes/(marketing)/search/api/+server.ts rename to src/routes/(marketing)/search/api.json/+server.ts