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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user