Skip to content

[BUG] search.rs Deduplication Loses Best Chunk When Multiple Files Have Same Path #182

@xyz080125

Description

@xyz080125

Project

vgrep

Description

In search.rs, the deduplication logic in search() uses a HashMap keyed by file path to keep the best chunk per file. However, if result.path.clone() produces identical paths for different chunks (e.g., due to symlinks or path normalization issues), the deduplication may incorrectly merge results from different logical locations.

Error Message

Debug Logs

System Information

OS: Windows 10/Linux
Rust Version: 1.75+\n

Screenshots

No response

Steps to Reproduce

  1. Create a directory with symlinked files pointing to the same target
  2. Index the directory with vgrep
  3. Search for content that exists in both the symlink and the original file
  4. Observe the deduplication behavior

Expected Behavior

Results should either show both entries (symlink and original) or clearly document the symlink-following behavior

Actual Behavior

The HashMap-based deduplication may silently drop one of the results when paths resolve to the same string

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvalidValid issuevgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions