import type { AnyOrama } from "@orama/orama"; /** * The minimal document shape both the client-side search dialog and the * server-side MCP `search_docs` tool index. Mirrors the `blume-search.json` * entries built by `buildSearchDocuments`. */ export interface OramaDoc { content: string; description: string; route: string; title: string; /** Locale code; indexed as an enum so queries can filter to one language. */ locale?: string; /** * Docs version; indexed as an enum so queries can filter to one version. * The current docs carry `""`, which the enum stores and matches exactly. */ version?: string; /** Resolved page `type`; indexed as an enum so queries can filter by type. */ contentType?: string; /** Declared facet values (`content.types..facets`), key → value. */ facets?: Record; /** Carried through for the search dialog's breadcrumb + filter pills. Stored * but not indexed, so they ride along on the returned document untouched. */ breadcrumb?: string[]; section?: string; } /** * Build an in-memory Orama full-text index from search documents. Shared by the * Orama client loader (browser), the MCP server, and Ask AI grounding (Node), * so ranking is identical wherever docs are queried. `locale` — the site's * `i18n.defaultLocale` — swaps in a word-segmenting tokenizer for every * non-Latin script, all of which Orama's default tokenizer reduces to zero * tokens; the tokenizer belongs to the database, so on a mixed-locale site it * applies to every document. That is safe in one direction only: Latin words * survive segmentation intact, so English pages on a segmented index stay * searchable, but non-Latin translations on a Latin-default index still * collapse to zero tokens. */ export declare const buildOramaIndex: (documents: OramaDoc[], locale?: string) => Promise; /** Optional exact-match filters applied to a query via Orama's `where`. */ export interface OramaQueryFilters { /** Keep only documents whose `contentType` is in this list. */ contentTypes?: string[]; /** * Keep only documents matching every facet, key → required value. Facet * keys and values come from the `facets` field on the indexed documents. */ facets?: Record; /** Keep only documents in this locale. */ locale?: string; /** * Keep only documents of this docs version (`""` is the current docs — a * meaningful filter value, so absence alone disables version filtering). */ version?: string; } /** * Query the index, returning the matching documents (highest-ranked first). * `filters` narrows results by exact `where` matches on the enum fields: * `locale` to one language, `contentTypes` to a set of page types, `facets` * to documents carrying every requested `key:value` term. * * On a bigrammed index the strict pass runs first: a term is only meant to * match where its bigrams sit together, and scoring them independently lets a * page sharing a couple of windows outrank the page the term is about. Terms * spanning several words rarely appear in full on one page, so an empty strict * result falls back to the default pass rather than reporting no matches. */ export declare const queryOramaIndex: (db: AnyOrama, term: string, limit: number, filters?: OramaQueryFilters) => Promise;