Skip to content

Commit

Permalink
Merge pull request #114 from CriticalMoments/json_extension_gzip
Browse files Browse the repository at this point in the history
Add json extension for a valid content-type
  • Loading branch information
scosman authored Jul 31, 2024
2 parents 2b62ca4 + 2f199e0 commit 5d65e4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit 5d65e4d

Please sign in to comment.