diff --git a/src/components/Search.svelte b/src/components/Search.svelte index 584f79ef..9a93a784 100644 --- a/src/components/Search.svelte +++ b/src/components/Search.svelte @@ -1,13 +1,18 @@ diff --git a/src/global.d.ts b/src/global.d.ts index b51df520..8d4042be 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -4,5 +4,38 @@ declare global { interface Window { // type from '@swup/astro' is incorrect swup: AstroIntegration; + pagefind: { + search: (query: string) => Promise<{ + results: Array<{ + data: () => Promise; + }>; + }>; + }; } } + +interface SearchResult { + url: string; + meta: { + title: string; + }; + excerpt: string; + content?: string; + word_count?: number; + filters?: Record; + anchors?: Array<{ + element: string; + id: string; + text: string; + location: number; + }>; + weighted_locations?: Array<{ + weight: number; + balanced_score: number; + location: number; + }>; + locations?: number[]; + raw_content?: string; + raw_url?: string; + sub_results?: SearchResult[]; +}