Skip to content

Expose raw semantic cosine scores in search results#230

Closed
yasyf wants to merge 1 commit into
MinishLab:mainfrom
yasyf:cosine-scores
Closed

Expose raw semantic cosine scores in search results#230
yasyf wants to merge 1 commit into
MinishLab:mainfrom
yasyf:cosine-scores

Conversation

@yasyf

@yasyf yasyf commented Jul 22, 2026

Copy link
Copy Markdown

Hybrid search currently returns only the fused RRF score, which reflects rank position rather than absolute semantic relevance — a top-ranked result over weak matches is indistinguishable from a genuinely strong hit (RRF caps near 1/61 per leg before boosts).

This adds a semantic_score field to SearchResult carrying the dense leg's raw cosine similarity, threaded through fusion and both reranking paths without changing ranking behavior. BM25-only results expose semantic_score: None. The field is included in CLI and MCP output.

Motivation: agent consumers (we drive semble from the ccx/cc-context MCP facade) need an absolute relevance signal to detect all-weak result sets instead of mistaking top-ranked junk for evidence.

  • Additive only; no ranking or API behavior changes
  • Exact known-distance tests cover the cosine conversion (a sign inversion now fails), plus BM25-only None coverage
  • pytest green, 100% coverage maintained, pre-commit hooks pass

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Reviews (1): Last reviewed commit: "Expose semantic cosine scores in search ..." | Re-trigger Greptile

@stephantul

Copy link
Copy Markdown
Contributor

Hey, please read the CONTRIBUTING.md and open an issue first. Also, we use PR templates for a reason, please don't ignore them. Closing for now.

@stephantul stephantul closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants