Merge pull request #1156 from toy0116/pr/hybrid-search-matchcount-fix
fix(hybrid-search): guard MatchCount=0 truncating all resultsmain
commit
478a6521ea
|
|
@ -248,10 +248,14 @@ func (s *knowledgeBaseService) HybridSearch(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if len(deduplicatedChunks) > params.MatchCount {
|
||||
deduplicatedChunks = deduplicatedChunks[:params.MatchCount]
|
||||
// Limit to MatchCount; 0 means "no explicit limit" — use over-retrieval floor (50).
|
||||
effectiveMatchCount := params.MatchCount
|
||||
if effectiveMatchCount <= 0 {
|
||||
effectiveMatchCount = 50
|
||||
}
|
||||
if len(deduplicatedChunks) > effectiveMatchCount {
|
||||
deduplicatedChunks = deduplicatedChunks[:effectiveMatchCount]
|
||||
}
|
||||
|
||||
return s.processSearchResults(ctx, deduplicatedChunks, params.SkipContextEnrichment)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue