import { ParsedQuery } from '../types'; /** * QueryParser - Parses search queries into structured format with tokenization and synonym expansion * * Supports: * - Multi-word queries with intelligent tokenization * - Exact phrase matching with quotes * - Excluded terms with minus operator * - Special operators (type:, param:, return:, etc.) * - Synonym expansion for common programming terms * - Fuzzy search and stemming flags */ export declare class QueryParser { private static readonly SYNONYMS; private static readonly OPERATORS; /** * Parse a search query string into a structured ParsedQuery object * @param query The raw search query string * @returns ParsedQuery object with extracted terms, filters, and options */ parse(query: string): ParsedQuery; /** * Extract quoted phrases from the query * Handles nested quotes and escape sequences * @param query The query string * @returns Array of phrase objects with original and cleaned value */ private extractPhrases; /** * Extract operators and their values from the query * Handles quoted values and escape sequences * @param query The query string * @returns Object with operators map and cleaned query */ private extractOperators; /** * Apply operator filters to the parsed query * @param operators Map of operators and values * @param parsedQuery The parsed query object to update */ private applyOperatorFilters; /** * Tokenize a string into individual words * @param text The text to tokenize * @returns Array of tokens */ private tokenize; /** * Get synonyms for a given term * @param term The term to find synonyms for * @returns Array of synonyms (not including the original term) */ getSynonyms(term: string): string[]; /** * Expand a query with synonyms (utility method) * @param query The original query * @returns Expanded query with synonyms */ expandQuery(query: string): string; } export declare const queryParser: QueryParser; /** Compiled SQL query fragments for use with the SQLite-backed CodeIndexDB. */ export interface SqlQuery { /** FTS5 MATCH expression, or null if no free-text terms */ ftsMatch: string | null; /** WHERE clause fragments (ANDed together) */ whereClauses: string[]; /** JOIN clauses for call/dependency graph traversal */ joinClauses: string[]; /** Named parameters for the prepared statement */ params: Record; /** ORDER BY clause */ orderBy: string; /** LIMIT value */ limit: number; /** OFFSET value */ offset: number; } /** * Compile a parsed query into SQL fragments for the SQLite-backed CodeIndexDB. * * The caller assembles the final SQL from the returned fragments: * ```sql * SELECT f.* [, bm25(functions_fts) as score] * FROM functions f * [JOIN functions_fts ON functions_fts.rowid = f.id] -- when ftsMatch is set * {joinClauses...} * WHERE 1=1 * [AND functions_fts MATCH @ftsMatch] -- when ftsMatch is set * {whereClauses...} * ORDER BY {orderBy} * LIMIT {limit} OFFSET {offset} * ``` * * @param parsedQuery The parsed query from {@link QueryParser.parse}. * @param options Optional overrides for limit/offset. * @returns Compiled SQL fragments. */ export declare function compileToSQL(parsedQuery: ParsedQuery, options?: { defaultLimit?: number; offset?: number; }): SqlQuery; //# sourceMappingURL=QueryParser.d.ts.map