feat(retrieval): configurable RRF parameters per tenant

Reciprocal Rank Fusion previously hard-coded k=60 and weights 0.7/0.3.
Both are now sourced from RetrievalConfig (RRFK, RRFVectorWeight,
RRFKeywordWeight) with the same numbers as defaults via three new
GetEffective accessors. fuseOrDeduplicate / fuseWithRRF accept the
config; HybridSearch reads it from tenantInfo and forwards.

Lets corpus owners tune fusion behavior — large corpora benefit from
larger k, keyword-heavy domains from a higher keyword weight, etc. —
without changing application code.

https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
This commit is contained in:
Claude
2026-05-02 09:35:32 +00:00
committed by lyingbug
parent 0dc32cb0c4
commit 2850ac78ce
3 changed files with 49 additions and 8 deletions
@@ -152,7 +152,11 @@ func (s *knowledgeBaseService) HybridSearch(ctx context.Context,
}
logger.Infof(ctx, "Result count before fusion: vector=%d, keyword=%d", len(vectorResults), len(keywordResults))
deduplicatedChunks := fuseOrDeduplicate(ctx, vectorResults, keywordResults)
var retrievalCfg *types.RetrievalConfig
if tenantInfo != nil {
retrievalCfg = tenantInfo.RetrievalConfig
}
deduplicatedChunks := fuseOrDeduplicate(ctx, vectorResults, keywordResults, retrievalCfg)
kb.EnsureDefaults()