/** * JSON Data Index Module * * Provides JSON file search using: * - Literal indexing of dot-notation key paths (e.g., "package.dependencies.react") * - BM25 keyword matching for fuzzy search * * Note: This module uses literal-only indexing (no embeddings) for fast indexing. * JSON keys are indexed as dot-notation paths prefixed with the filename. * * Supported file types: .json * * Index location: .raggrep/index/data/json/ */ import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, SearchResult, ModuleConfig } from "../../../types"; /** Default minimum similarity score for search results */ export declare const DEFAULT_MIN_SCORE = 0.1; /** Default number of results to return */ export declare const DEFAULT_TOP_K = 10; /** File extensions supported by this module */ export declare const JSON_EXTENSIONS: string[]; /** * Check if a file is supported by this module. */ export declare function isJsonFile(filepath: string): boolean; export declare const supportsFile: typeof isJsonFile; /** * Module-specific data stored alongside file index */ export interface JsonModuleData { /** Dot-notation paths extracted from the JSON file */ jsonPaths: string[]; [key: string]: unknown; } export declare class JsonModule implements IndexModule { readonly id = "data/json"; readonly name = "JSON Search"; readonly description = "JSON file search with literal-based key path indexing"; readonly version = "2.0.0"; supportsFile(filepath: string): boolean; private symbolicIndex; private literalIndex; private pendingSummaries; /** Map from chunkId → { filepath, literals } for building literal index */ private pendingLiterals; private rootDir; private logger; initialize(config: ModuleConfig): Promise; indexFile(filepath: string, content: string, ctx: IndexContext): Promise; /** * Finalize indexing by building and saving the symbolic and literal indexes. * Uses incremental updates when possible to avoid full rebuilds. */ finalize(ctx: IndexContext): Promise; /** * Search the JSON index for files matching the query. * * Uses a two-source approach: * 1. Literal index for exact path matches (e.g., `package.dependencies.react`) * 2. BM25 keyword search for fuzzy matching * * @param query - Search query (supports backticks for exact literal matching) * @param ctx - Search context with index access * @param options - Search options (topK, minScore, filePatterns) * @returns Array of search results sorted by relevance */ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise; }