/** * Hybrid retrieval ranking weights — numeric knobs only, suitable for config * and benchmark-driven tuning. Defaults follow golden-query sweeps on next-convex-starter-app * (wave 2 winner: combined TS + markdown doc-intent; bge-small-en-v1.5, core + TS + markdown). */ import type { LiteralMatchType, LiteralConfidence } from "./literal"; /** BM25-IDF–guided salient-term adjustment (all embedding-backed language + markdown modules). */ export interface DiscriminativeWeights { boostCap: number; penaltyMax: number; penaltyFloor: number; } /** TypeScript/JS module: semantic + BM25 + vocabulary blend. */ export interface TypeScriptRankingWeights { semantic: number; bm25: number; vocab: number; /** Include chunk when vocab overlap exceeds this (bypass path). */ vocabBypassThreshold: number; } /** Rust, Go, Python modules: two-way blend. */ export interface LanguageRankingWeights { semantic: number; bm25: number; } /** Markdown docs module. */ export interface MarkdownRankingWeights { semantic: number; bm25: number; /** Boost when query looks documentation-intent (legacy keyword list). */ docIntentBoost: number; /** `headingBoost *= min + span * phraseMatch.coverage` */ headingPhraseCoverageMin: number; headingPhraseCoverageSpan: number; } /** Per-confidence multipliers for one literal match kind (definition / reference / import). */ export type LiteralConfidenceMultipliers = Record; /** * Literal-match boosting: multipliers when identifier/path literals align with the query, * plus vocabulary overlap tuning (TypeScript vocabulary track). */ export interface LiteralBoostWeights { /** Base score when a chunk is reached only via the literal index (no BM25/semantic). */ baseScore: number; multipliers: Record; vocabulary: { baseMultiplier: number; perWordBonus: number; maxVocabularyBonus: number; minWordsForMatch: number; }; } /** JSON data module (BM25 + literal paths). */ export interface JsonRankingWeights { bm25: number; /** Scales literal-only base when BM25 is zero. */ literalBaseWeight: number; } /** Full resolved set used by search (every field required). */ export interface RankingWeightsConfig { discriminative: DiscriminativeWeights; typescript: TypeScriptRankingWeights; language: LanguageRankingWeights; markdown: MarkdownRankingWeights; json: JsonRankingWeights; /** Literal / backtick / identifier match boosting (language + JSON modules). */ literal: LiteralBoostWeights; } /** Partial overrides for {@link SearchOptions} or persisted module options. */ export type RankingWeightsPartial = { [K in keyof RankingWeightsConfig]?: Partial; }; export declare const DEFAULT_DISCRIMINATIVE_WEIGHTS: DiscriminativeWeights; /** Default literal boosting (same coefficients as the original literal scorer). */ export declare const DEFAULT_LITERAL_BOOST_WEIGHTS: LiteralBoostWeights; export declare const DEFAULT_RANKING_WEIGHTS: RankingWeightsConfig; /** * Merge partial literal-boost overrides (including nested multipliers / vocabulary). */ export declare function mergeLiteralWeights(def: LiteralBoostWeights, partial?: Partial): LiteralBoostWeights; /** * Deep-merge partial ranking overrides onto defaults. Pure function. */ export declare function mergeRankingWeights(partial?: RankingWeightsPartial): RankingWeightsConfig;