`codegraph query` printed `(score * 100)%` next to each hit, but `score` is an unbounded BM25/FTS relevance magnitude (relative-ranking only), so it rendered as values like "12042%" that made the output look broken. Results already arrive in rank order, so drop the score from the human-readable output entirely — matching the MCP search tool, which shows no score. The raw `score` stays in `--json` for programmatic sorting/thresholding. Also corrects the SearchResult.score doc comment, which wrongly claimed a 0-1 range. Adds an end-to-end regression test. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0d331b9017
commit
4b58a6d2d0
+6
-1
@@ -398,7 +398,12 @@ export interface SearchResult {
|
||||
/** Matching node */
|
||||
node: Node;
|
||||
|
||||
/** Relevance score (0-1) */
|
||||
/**
|
||||
* Relevance score for relative ranking only — higher is more relevant.
|
||||
* NOT normalized and NOT a 0-1 fraction: the FTS path returns an unbounded
|
||||
* BM25 magnitude (often in the tens or hundreds), while the fuzzy/exact
|
||||
* paths return ~0-1. Use it to order results, not as an absolute percentage.
|
||||
*/
|
||||
score: number;
|
||||
|
||||
/** Matched text snippets for highlighting */
|
||||
|
||||
Reference in New Issue
Block a user