Summary
Search highlight occurrence columns are based on the original source line, while the returned snippet line may be clamped. Clients cannot tell whether a term occurrence is visible in the returned text or hidden behind a clamp marker.
Current source evidence
SearchHighlight includes OriginalLineLength, Truncated, TermOccurrences, and Text.
SearchTermOccurrence has original line, column, and length, but no visible/clamped span mapping.
Proposed improvement
Add visible-range metadata for highlight terms, such as visible, visible_column, visible_length, or a line-level original-to-snippet span map.
Acceptance notes
- Original coordinates remain available for source navigation.
- Returned metadata is enough to highlight only visible text in compact snippets.
- Tests cover a long line where one occurrence is visible and another is truncated away.
Summary
Search highlight occurrence columns are based on the original source line, while the returned snippet line may be clamped. Clients cannot tell whether a term occurrence is visible in the returned text or hidden behind a clamp marker.
Current source evidence
SearchHighlightincludesOriginalLineLength,Truncated,TermOccurrences, andText.SearchTermOccurrencehas originalline,column, andlength, but no visible/clamped span mapping.Proposed improvement
Add visible-range metadata for highlight terms, such as
visible,visible_column,visible_length, or a line-level original-to-snippet span map.Acceptance notes