fix(roda-mcp-server): rank search_datasets by relevance, drop stop words - #4463
Open
ariharrisonlab wants to merge 1 commit into
Open
fix(roda-mcp-server): rank search_datasets by relevance, drop stop words#4463ariharrisonlab wants to merge 1 commit into
ariharrisonlab wants to merge 1 commit into
Conversation
search_datasets matched query terms by substring (only data/dataset/datasets were filtered) and then ordered results by provider diversity with no relevance score. Broad natural-language queries therefore matched hundreds of datasets, and the most relevant one could be pushed out of the top results by less-relevant datasets from other providers -- so a more specific query returned worse results than a single keyword. - Expand stop-word removal so multi-word queries narrow instead of matching nearly everything via substring. - Add a field-weighted relevance score (exact tag > name > description) with a coverage bonus, and sort matches by score before the provider-diversity pass so diversification applies within relevance order. - Keep the permissive substring match gate (no recall regression) and the JSON response shape unchanged; the internal score is stripped from output. - Add tests for relevance ordering, stop-word handling, and score omission.
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.
Fixes #4462
Summary
search_datasetsmatched query terms by substring (onlydata/dataset/datasetswere filtered) and then ordered results by provider diversity with no relevance score. Broad natural-language queries therefore matched hundreds of datasets, and the most relevant one could be pushed out of the top results by less-relevant datasets from other providers — so a more specific query returned worse results than a single keyword.Changes
User experience
Against the live registry index (1,177 datasets):
ADMETcheminformaticsdrug discovery molecules with ADMET predictionsBefore, adding descriptive words to a query buried the best match; after, a more specific query returns more relevant, better-ranked results (for that example the top 3 are the three actual drug-discovery datasets in the registry). Single-keyword and filtered-query behavior is unchanged.
Checklist
pytest tests/— 93 passed;ruff check+ruff formatclean)Is this a breaking change? (N)
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.