/** * BM25 ranking implementation — no external dependencies. * * Algorithm: Okapi BM25 with standard parameters (k1=1.5, b=0.75). */ interface Bm25Doc { id: number; tokens: string[]; raw: string; len: number; } /** * Tokenise a string into lowercase word tokens. * * Preserves apostrophes so that identifiers like `can't` or `user's` * remain a single token. Underscores are treated as separators (they * conventionally split words in snake_case identifiers). */ export declare function tokenise(text: string): string[]; interface IndexableDoc { id: number; text: string; } /** * Max chars of `signature` fed to the FTS index (P1, 2026-08-30). * * `signature` stores the full printed declaration — often including the whole * function body, because `ts-parser`'s getSignature uses `printer.printNode` * (capped at 500 chars). Measured on the live 131k-row index: ts+tsx signature * text was ~70% of all trigram FTS input, and capping to the declaration * header cut FTS size 47% and insert time 20-32%. Only the FTS *input* is * capped; the stored `signature` column (display, embeddings fallback) is * untouched. */ export declare const FTS_SIGNATURE_MAX_CHARS = 300; /** * Build indexable text for BM25 from a symbol's fields. * The name is split into camelCase/SnakeCase words so that queries * like "complex" match "complexOperation". The verbatim name is * also included for exact-match queries. The signature contributes * only its declaration header (see {@link ftsSignature}). */ export declare function buildIndexableText(name: string, signature: string, docComment: string): string; export declare function buildBm25Index(docs: IndexableDoc[]): Bm25Index; export declare class Bm25Index { private documents; private N; private readonly safeAvgLen; /** Lazily-built id→doc index so getDoc is O(1) instead of an O(D) linear find. */ private _byId; constructor(documents: Bm25Doc[], N: number, avgLen: number); score(query: string, filter?: (id: number) => boolean): Array<{ id: number; score: number; }>; getDoc(id: number): Bm25Doc | undefined; extractSnippet(docId: number, queryTokens: string[], radius?: number): string; } export {}; //# sourceMappingURL=bm25.d.ts.map