import { type AttachmentHydrationResult, type ChunkRow, type SearchOptions, type SearchResult, type VectorChunk, type VectorStoreConfig } from './types.js'; export type { AttachmentHydrationResult, GroupingMode, HydratedChunkAttachments, SearchResult, VectorChunk, VisualAttachment, } from './types.js'; /** Vector storage over LanceDB, including the delete-then-insert atomicity. */ export declare class VectorStore { private db; private table; private openingTable; private readonly config; private ftsEnabled; constructor(config: VectorStoreConfig); /** * Initialize LanceDB and create table */ initialize(): Promise; /** Discover a table created after this connection was initialized. */ private openExistingTable; /** @returns the number of chunks removed; 0 when nothing matched. */ deleteChunks(filePath: string): Promise; /** * Chunk rows for one file with chunkIndex in the inclusive [minIdx, maxIdx] * range. The ascending sort is a contract, not incidental storage order. * * Feature-agnostic: before/after/isTarget semantics live in the handler. */ getChunksByRange(filePath: string, minIdx: number, maxIdx: number): Promise; /** * Every stored chunk for a file as a full {@link VectorChunk}, embedding * included, so it can be re-inserted verbatim. The ingest handler backs data * up with this before a destructive re-ingest, so a failure rolls back * without corrupting vectors. */ getChunksByFilePath(filePath: string): Promise; /** * Batch insert vector chunks */ insertChunks(chunks: VectorChunk[]): Promise; /** * Ensure FTS index exists for hybrid search * Creates ngram-based index if it doesn't exist, drops old versions * @throws DatabaseError if index creation fails (Fail-Fast principle) */ private ensureFtsIndex; /** * Ensure schema is up to date by adding missing columns and dropping the ones * nothing reads. * Uses table.addColumns() API for top-level column additions. * Idempotent: checks for column existence before adding or dropping. */ private ensureSchemaVersion; /** * Compact fragments, update the FTS index, and drop old versions. LanceDB OSS * only updates the FTS index on an explicit call. * * The caller decides when — once per ingest rather than per insert, to avoid * O(n^2) during bulk work. */ optimize(): Promise; /** * Semantic search → maxDistance/grouping filter → keyword boost → maxFiles. * * Prefetch-then-rerank, so the distance filters see real vector distances and * keyword matching boosts rather than replaces semantic similarity. */ /** * Rerank vector hits with BM25 scores for the same files. A failure degrades * this request only — FTS stays enabled, so the next query retries hybrid. */ private boostWithKeywords; private getCandidateLimit; search(queryVector: number[], options?: SearchOptions): Promise; /** * Load and validate attachments for the ordered unique final search identities. * Candidate retrieval and ranking are deliberately complete before this one * projected batch query runs. */ hydrateVisualAttachments(results: readonly { id: string; }[]): Promise; /** * `.where()` predicate restricting `filePath` to the exact-or-descendant set * of the given prefixes. The separator boundary stops `/a/b` from matching * `/a/bc`. Vector branch only — FTS inherits scope via its own `IN (...)`. */ private buildScopePredicate; /** Build the exact-or-descendant predicate for a single prefix. */ private buildPrefixPredicate; /** Escape single quotes for a SQL string literal (mirrors deleteChunks). */ private escapeQuotes; /** Escape for a LIKE term with `ESCAPE '\'`: backslash first (else it double-escapes), then `%`, `_`, then quotes. */ private escapeLike; /** * Per-chunk `(filePath, contentHash, visualProfile)` projection used by * incremental sync. * * One entry per row rather than per file, so a file whose rows disagree on the * hash or the recorded profile is detectable as dirty. `filePath` is the * verbatim stored spelling, since that is what {@link deleteChunks} matches. * The empty-string placeholder the create path seeds for Arrow inference * normalizes to `null`, while any other stored profile string reaches the * planner unchanged so it can validate the vocabulary itself. * * Projects only those three columns, so a manifest load does not materialize * embedding vectors or attachment payloads. */ listSyncManifest(): Promise<{ filePath: string; contentHash: string | null; visualProfile: string | null; }[]>; /** * Get list of ingested files */ listFiles(): Promise<{ filePath: string; chunkCount: number; timestamp: string; }[]>; /** * Get system status */ getStatus(): Promise<{ documentCount: number; chunkCount: number; memoryUsage: number; uptime: number; ftsIndexEnabled: boolean; searchMode: 'hybrid' | 'vector-only'; }>; /** * Close the database connection */ close(): Promise; } //# sourceMappingURL=index.d.ts.map