Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ParthJadhav opened this issue Nov 12, 2022 · 2 comments · Fixed by #22
Closed

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

ParthJadhav opened this issue Nov 12, 2022 · 2 comments · Fixed by #22
Assignees
Labels
bug Something isn't working

Comments

@ParthJadhav
Copy link
Owner

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 ?

@ParthJadhav ParthJadhav added the bug Something isn't working label Nov 12, 2022
@ParthJadhav ParthJadhav linked a pull request Nov 12, 2022 that will close this issue
@TheAwiteb
Copy link
Contributor

TheAwiteb commented Nov 12, 2022

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

@ParthJadhav
Copy link
Owner Author

Okay @TheAwiteb , Thanks a lot

TheAwiteb added a commit to TheAwiteb/rust_search that referenced this issue Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants