/** * Core Index Module * * Language-agnostic text search using: * - Regex-based symbol extraction * - BM25 keyword matching * - Line-based chunking * * Index location: .raggrep/index/core/ * * This module provides fast, deterministic search without embeddings. * It complements language-specific modules by catching symbol matches. */ import { IndexModule, IndexContext, SearchContext, SearchOptions } from "../../types"; import type { FileIndex, SearchResult, ModuleConfig } from "../../domain/entities"; import { type ExtractedSymbol } from "./symbols"; /** * Core module-specific data stored with file index */ export interface CoreModuleData { /** Extracted symbols */ symbols: ExtractedSymbol[]; /** BM25 tokens for this file */ tokens: string[]; [key: string]: unknown; } export declare class CoreModule implements IndexModule { readonly id = "core"; readonly name = "Core Search"; readonly description = "Language-agnostic text search with symbol extraction"; readonly version = "1.0.0"; /** * Core module accepts all files (it's the fallback). */ supportsFile(_filepath: string): boolean; private symbolIndex; private bm25Index; private rootDir; initialize(_config: ModuleConfig): Promise; /** * Index a single file. */ indexFile(filepath: string, content: string, ctx: IndexContext): Promise; /** * Create line-based chunks from content. */ private createChunks; /** * Convert symbol type to chunk type. */ private symbolTypeToChunkType; /** * Finalize indexing - build BM25 index and save symbol index. */ finalize(ctx: IndexContext): Promise; /** * Search the index. */ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise; /** * Find symbol name matches for query tokens. */ private findSymbolMatches; /** * Find the best matching chunk based on query tokens. */ private findBestChunk; /** * Load the symbol index from disk. */ private loadSymbolIndex; dispose(): Promise; }