/** * Simple Search Service * * Provides grep-like exact text matching across files. * This is a pure domain service - no file I/O, just algorithms. * * Used for: * - Finding exact occurrences of identifiers (SCREAMING_SNAKE, camelCase) * - Providing a guaranteed "exact match" track separate from semantic search * - Context lines around matches (+/- 1 line) */ import type { ExactMatchOccurrence, ExactMatchResults } from "../entities/searchResult"; /** * Check if a query string looks like a programming identifier. * These queries should trigger simple search in addition to semantic search. * * @param query - The search query * @returns true if the query looks like an identifier */ export declare function isIdentifierQuery(query: string): boolean; /** * Extract the literal to search for from a query. * Removes quoting if present. * * @param query - The search query * @returns The literal to search for */ export declare function extractSearchLiteral(query: string): string; /** * Find all occurrences of a literal in file content. * * @param content - The file content to search * @param literal - The exact string to find * @param options - Search options * @returns Array of match occurrences with context */ export declare function findOccurrences(content: string, literal: string, options?: { /** Maximum occurrences to return per file */ maxOccurrences?: number; /** Whether to do case-insensitive matching */ caseInsensitive?: boolean; }): ExactMatchOccurrence[]; /** * Search multiple files for exact matches of a literal. * * @param files - Map of filepath to content * @param literal - The exact string to find * @param options - Search options * @returns Exact match results */ export declare function searchFiles(files: Map, literal: string, options?: { /** Maximum files to return */ maxFiles?: number; /** Maximum occurrences per file */ maxOccurrencesPerFile?: number; /** Case-insensitive matching */ caseInsensitive?: boolean; }): ExactMatchResults; /** * Extract all identifier-like literals from content. * Used during indexing to build a literal index for plain text files. * * @param content - File content to extract from * @returns Array of unique identifier literals found */ export declare function extractIdentifiersFromContent(content: string): string[]; /** * Check if a file should be included in simple search based on its content. * Excludes binary files and very large files. * * @param content - File content * @param filepath - File path for extension checking * @returns true if file should be searchable */ export declare function isSearchableContent(content: string, filepath: string): boolean;