Skip to content

Fix exact line output for Markdown search results - #206

Open
harshkanhat wants to merge 2 commits into
lightonai:mainfrom
harshkanhat:fix-issue-205-markdown-line-output
Open

harshkanhat wants to merge 2 commits into
lightonai:mainfrom
harshkanhat:fix-issue-205-markdown-line-output

Conversation

@harshkanhat

Copy link
Copy Markdown

Description

This PR fixes an issue where Colgrep displays the entire Markdown document range instead of showing the exact line containing the search match.

Previously, Markdown files were treated as a single document during semantic search, causing the output to display the full file range rather than the specific matching line.

Changes Made

  • Added exact line matching for Markdown search results in compact semantic-only mode.
  • Updated the output to display the matching line number when a literal query match is found.
  • Preserved the existing semantic match output as a fallback when no literal match is found.
  • Added a regression test to verify that the correct line number is identified in Markdown files.

Testing

  • Added a regression test for Markdown line matching.
  • Full Rust test suite has not yet been run.

Related Issue

Fixes #205

// Semantic-only mode: files ordered by score; for each, its best matched
// units with their own range and name, so an agent can read exactly those
// lines (`path:start-end name`).
let query_matcher = PatternMatcher::new(query, false, true, false, case_sensitive);

@dbalabka dbalabka Nov 17, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Will it perform exact matching or semantic matching?
If it performs exact matching, it will fail if the query doesn't match the exact phrase when synonyms are used.
Please confirm that the logic still relies on semantic phrase matching.

This branch has not been deployed

No deployments
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.

Colgrep does not show exact line in markdown files

2 participants