Skip to content

feat: add min_score filter to search_code#43

Merged
iamvirul merged 3 commits into
mainfrom
feat/min-score-filter
May 19, 2026
Merged

feat: add min_score filter to search_code#43
iamvirul merged 3 commits into
mainfrom
feat/min-score-filter

Conversation

@iamvirul
Copy link
Copy Markdown
Member

@iamvirul iamvirul commented May 19, 2026

Summary

  • Adds min_score: float = 0.35 parameter to search_code to filter out low-relevance results before returning them
  • Values below the threshold (default 0.35 cosine similarity) are dropped as noise, reducing token usage without affecting result quality
  • get_index_status now shows the default threshold so users know filtering is active
  • min_score is clamped to [0.0, 1.0]; set to 0.0 to disable filtering entirely

Closes #35

Test plan

  • test_min_score_filters_low_scoring_results — high score passes, low score is dropped
  • test_min_score_zero_disables_filteringmin_score=0.0 passes everything through
  • test_min_score_clamped_above_one — values > 1.0 are clamped to 1.0
  • test_min_score_all_filtered_returns_no_results — returns "No results found" when all results are below threshold
  • test_returns_expected_fieldsget_index_status output includes Min score

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@iamvirul
Copy link
Copy Markdown
Member Author

@PairReviewer Review this

Copy link
Copy Markdown
Collaborator

@PairReviewer PairReviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@iamvirul iamvirul merged commit c94c986 into main May 19, 2026
2 checks passed
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.

[Feature]: Add minimum score threshold to filter low-relevance search results

2 participants