/** * FTS5 Query Utilities * * Utilities for normalizing and handling SQLite FTS5 full-text search queries. * * FTS5 has special query syntax that can cause unexpected behavior when users * search with natural language patterns (like hyphenated terms). These utilities * normalize user queries for FTS5 compatibility. */ /** * Normalize a search query for FTS5 compatibility with automatic prefix matching. * * FTS5 has special syntax that can cause unexpected behavior: * - Hyphens (-) are interpreted as negation operators (NOT) * - Colons (:) are used for column-specific searches * - Asterisks (*) at the END of a word are valid prefix wildcards (preserved) * - Asterisks (*) at the START are invalid (removed) * - Quotes (") group phrases * - Other special chars can cause syntax errors * * This function normalizes queries so users can search naturally * for hyphenated terms like "senior-dev" or "AX-manifesto-2025", * and automatically adds prefix wildcards for fuzzy matching. * * Fuzzy matching allows "debug" to match "debugging", "AX" to match "AX-006", etc. * * @example * normalizeFTS5Query("senior-dev") // "senior* dev*" * normalizeFTS5Query("AX-001") // "AX* 001*" * normalizeFTS5Query("datab*") // "datab*" (preserved - already has wildcard) * normalizeFTS5Query("debug") // "debug*" (adds wildcard for fuzzy matching) * normalizeFTS5Query("*test") // "test*" (leading asterisk removed, trailing added) * normalizeFTS5Query("merge:weave") // "merge* weave*" * normalizeFTS5Query("test search") // "test* search*" * normalizeFTS5Query("credential checking", false, "any") // "credential* OR checking*" * normalizeFTS5Query("api performance", false, "all") // "api* performance*" (default AND) * * @param query - User's raw search query * @param exact - If true, skip automatic prefix wildcards for exact matching (default: false) * @param mode - Search mode: 'all' (AND, default) or 'any' (OR) * @returns Normalized query safe for FTS5 MATCH */ export declare function normalizeFTS5Query(query: string, exact?: boolean, mode?: "all" | "any"): string;