Fix disease search ranking to surface exact-match canonical hits#188
Merged
Fix disease search ranking to surface exact-match canonical hits#188
Conversation
Exact user queries like "colorectal cancer" were being buried by subtype-heavy upstream ordering. This adds an overscan-and-rerank pass in disease search: multiple resolver queries feed a wider candidate pool, deduplicated by MONDO ID, then scored by exact/prefix/substring match against all candidate labels. The canonical exact-match node is now guaranteed to surface within the returned page. Adds regression unit test covering the colorectal cancer ranking case and updates the spec assertion to pin the canonical MONDO row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exact disease-name queries (e.g.
biomcp search disease "colorectal cancer" --limit 10) were returning subtype-heavy upstream results that buried the canonical disease node. The canonical exact match could fall outside the returned page entirely.This PR adds an overscan-and-rerank pass to disease search:
Changes
src/entities/disease.rs:rerank_disease_search_hitsfunction + integration into the search path with overscanspec/07-disease.md: spec assertion tightened to pin the canonical MONDO row (MONDO:0024331 | colorectal carcinoma)Testing
cargo test— 570 passed, 0 failedmake spec— 95 passed, 5 skipped, 0 failed