WeKnora/internal/application
toy0116 6ac396afb2 fix(hybrid-search): guard MatchCount=0 truncating all results
When HybridSearch is called from the HTTP endpoint without a
match_count field, params.MatchCount defaults to Go's zero value.
The guard

  if len(deduplicatedChunks) > params.MatchCount { … [:0] }

then silently truncated every result list to empty, so processSearchResults
was called with 0 chunks and returned nil — 64 RRF-fused results → 0.

Fix: treat MatchCount ≤ 0 as "no explicit limit" and fall back to the
same floor (50) used by the over-retrieval phase.  Callers that set
MatchCount explicitly (chat pipeline, knowledge.go, agent tools) are
unaffected.

Verified: vector=50 + keyword=50 → RRF=64 → processSearchResults(50) → 108
final results (50 primary + 61 enrichment neighbours/parents) for
"M1000 MP frequency bands LTE cellular" query.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 18:13:26 +08:00
..
repository fix(schema): expand knowledge source length 2026-06-05 15:12:25 +08:00
service fix(hybrid-search): guard MatchCount=0 truncating all results 2026-06-10 18:13:26 +08:00