Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json extension for a valid content-type #114

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/build_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions src/routes/(marketing)/search/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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}`)
}
Expand Down
Loading