feat: add min_score filter to search_code#43
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Member
Author
|
@PairReviewer Review this |
PairReviewer
approved these changes
May 19, 2026
Collaborator
PairReviewer
left a comment
There was a problem hiding this comment.
This PR adds a min_score parameter to the search_code function, enabling filtering of low-relevance results and surfacing the threshold in get_index_status. The implementation clamps min_score to [0.0, 1.0], handles edge cases, and is well-covered by tests. No bugs, security issues, or missing error handling were found; the code is production-ready.
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
min_score: float = 0.35parameter tosearch_codeto filter out low-relevance results before returning themget_index_statusnow shows the default threshold so users know filtering is activemin_scoreis clamped to[0.0, 1.0]; set to0.0to disable filtering entirelyCloses #35
Test plan
test_min_score_filters_low_scoring_results— high score passes, low score is droppedtest_min_score_zero_disables_filtering—min_score=0.0passes everything throughtest_min_score_clamped_above_one— values > 1.0 are clamped to 1.0test_min_score_all_filtered_returns_no_results— returns "No results found" when all results are below thresholdtest_returns_expected_fields—get_index_statusoutput includesMin score