ParthJadhav / Rust_Search

Blazingly fast file search library built in Rust
MIT License
140 stars 15 forks source link

[Bug]: Search input includes `location` to search for #20

Closed ParthJadhav closed 2 years ago

ParthJadhav commented 2 years ago
let search: Vec<String> = SearchBuilder::default()
        .location("/System/")
        .search_input("Syste")
        .depth(1)
        .ignore_case()
        .build()
        .collect();

This will return everything contained in /System/ directory because the Regex will be matched with the path input i.e /System/ and return everything.

This could be solved by adding: .split("/").last().unwrap() to path

reg_exp.is_match(&path.split("/").last().unwrap())

@TheAwiteb , Is there a better way to do this? Or are there any implications using this approach ?

TheAwiteb commented 2 years ago

Yes, we can use Path::file_name. Assign it to me, i'll solve it

ParthJadhav commented 2 years ago

Okay @TheAwiteb , Thanks a lot