import type { Database as DatabaseType } from 'better-sqlite3'; /** * Free-text Todo search over the FTS5 indexes owned by `search-index.ts` * (ICI-1369). The store asks this module for the matching Todo ids in relevance * order, composes its own filters around that id set in SQL, and then asks back * for the reason each row of the page it is about to return matched. * * The two halves are separate because they are bounded differently: the id set * must be the WHOLE match set or a structured filter could intersect with a * truncated head of it and miss rows, while `snippet()` only ever has to run * over one page. */ export interface WorkItemMatch { /** Where the hit landed. `id` is an exact Todo-id lookup, not a text hit. */ field: 'id' | 'title' | 'body' | 'comment'; /** The matching comment, present only when `field` is `comment`. */ commentId?: string; /** Surrounding text with the hits wrapped in ``. */ snippet: string; } /** * Turn free text into an FTS5 MATCH expression that can only ever be a * conjunction of literal phrases: every whitespace-separated word is reduced to * its letter/digit runs and requoted. `"`, `*`, `NEAR(a b)`, `-foo` and the * rest therefore arrive as ordinary search terms and can never reach the FTS5 * parser as syntax. Null when no searchable term survives. */ export declare function toFtsMatchExpression(text: string): string | null; /** * Every Todo matching `text`, best match first, with no ceiling. The ids reach * SQL as a single JSON parameter rather than one bind variable each, so the * whole match set — not a truncated head of it — is what the store's other * filters intersect with and what its counts are computed from. */ export declare function searchWorkItemIds(db: DatabaseType, text: string): string[]; /** * Why each of `ids` matched `text`, best reason first, keyed by Todo id. Every * requested id gets an entry so a caller never has to distinguish "no reason" * from "not asked about". Bounded by the caller to the page it is returning, * which is what keeps `snippet()` off the whole match set. */ export declare function workItemMatchReasons(db: DatabaseType, text: string, ids: readonly string[]): Record; //# sourceMappingURL=search.d.ts.map