-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
memory-core: mergeHybridResults ignores textScore when keyword/vector chunk IDs don't overlap #92337
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.clownfishTracked by Clownfish automationTracked by Clownfish automationimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.clownfishTracked by Clownfish automationTracked by Clownfish automationimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Issue: mergeHybridResults ignores textScore when keyword and vector results have non-overlapping chunk IDs
Summary
In hybrid memory search,
mergeHybridResultsonly updatestextScorewhen keyword and vector results share the same chunk ID. When they don't overlap (common with CJK/trigram queries), the keyword search results are effectively discarded —textScorestays 0 even thoughsearchKeywordreturned valid results.Environment
trigramRoot Cause
In
extensions/memory-core/src/host/search/manager.ts,mergeHybridResultsmerges keyword and vector results by chunk ID:When keyword results have different chunk IDs than vector results:
textScore: 0vectorScore: 0vectorWeight * 0 + textWeight * textScore→ very low, often belowminScoreReproduction
agents.defaults.memorySearch.store.fts.tokenizer: "trigram"memory_searchwith a multi-character CJK query (e.g., "飞书插件配置")searchKeywordreturns rows withusedMatch: true, but final results showtextScore: 0Logs confirm keyword search works:
But the final output:
{ "textScore": 0, "vectorScore": 0.597 }Expected Behavior
Keyword search results should contribute to
textScoreeven when chunk IDs don't perfectly overlap with vector results. Possible approaches:minScore)path + startLinerange instead of exact chunk IDImpact
trigramtokenizer always havetextScore: 0in hybrid mode