-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
Project
vgrep
Description
The path prefix search uses a SQL LIKE pattern without ensuring directory boundaries, causing unintended matches with similarly-named directories.
Error Observation
Searching with path prefix /home/user/proj also matches /home/user/project, /home/user/proj-backup, etc.
Error Message
Debug Logs
System Information
Version: 0.1.0
## Operating System
OS: Ubuntu 24.04.3 LTS
Kernel: 6.8.0-79-generic
Arch: x86_64
## Hardware
CPU: AMD Ryzen 9 5950X 16-Core Processor (4 cores)
RAM: 11 GB
## Build Environment
Rust: rustc 1.92.0 (ded5c06cf 2025-12-08)
Target: x86_64Screenshots
No response
Steps to Reproduce
- Index two directories:
/home/user/projand/home/user/project - Search with path prefix
/home/user/proj - Observe that results include files from both directories
Code in src/core/db.rs line 162:
let path_prefix_str = path_prefix.to_string_lossy();
let like_pattern = format!("{}%", path_prefix_str);
### Expected Behavior
Should add trailing slash to ensure only files within the exact directory are matched.
### Actual Behavior
Search results include files from sibling directories with similar name prefixes.
### Additional Context
_No response_