{"id":15498286,"url":"https://github.com/parthjadhav/rust_search","last_synced_at":"2025-04-05T00:07:38.471Z","repository":{"id":62253927,"uuid":"559135242","full_name":"ParthJadhav/Rust_Search","owner":"ParthJadhav","description":"Blazingly fast file search library built in Rust","archived":false,"fork":false,"pushed_at":"2023-12-26T06:41:03.000Z","size":34,"stargazers_count":152,"open_issues_count":8,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T23:06:03.799Z","etag":null,"topics":["crate","fast","filesearch","filesystem","hacktoberfest","library","recursive-algorithm","rust","rust-lang","rust-search","rustsearch","search","search-algorithm","search-engine"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ParthJadhav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-29T06:55:19.000Z","updated_at":"2025-03-25T06:41:54.000Z","dependencies_parsed_at":"2024-08-02T00:20:32.942Z","dependency_job_id":null,"html_url":"https://github.com/ParthJadhav/Rust_Search","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthJadhav%2FRust_Search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthJadhav%2FRust_Search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthJadhav%2FRust_Search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthJadhav%2FRust_Search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ParthJadhav","download_url":"https://codeload.github.com/ParthJadhav/Rust_Search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crate","fast","filesearch","filesystem","hacktoberfest","library","recursive-algorithm","rust","rust-lang","rust-search","rustsearch","search","search-algorithm","search-engine"],"created_at":"2024-10-02T08:43:00.490Z","updated_at":"2025-04-05T00:07:38.436Z","avatar_url":"https://github.com/ParthJadhav.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Group 1](https://user-images.githubusercontent.com/42001064/198829818-c4035432-8721-45e1-ba2d-4d2eb6d0c584.svg)\n\nBlazingly fast file search crate built in Rust 🔥\n\n[![Version info](https://img.shields.io/crates/v/rust_search.svg)](https://crates.io/crates/rust_search)\n[![Documentation](https://docs.rs/rust_search/badge.svg)](https://docs.rs/rust_search)\n[![License](https://img.shields.io/crates/l/rust_search.svg)](https://github.com/parthjadhav/rust_search/blob/master/LICENSE-MIT)\n\n\u003c/div\u003e\n\n## 📦 Usage\n\nPlease report any problems you encounter when using rust search here: [Issues](https://github.com/ParthJadhav/rust_search/issues)\n\nAdd `rust_search = \"2.0.0\"` in Cargo.toml.\n\n```toml\n[dependencies]\nrust_search = \"2.0.0\"\n```\n\n## Examples\n\n- General use\n\n```rust\nuse rust_search::SearchBuilder;\n\nfn main(){\n    let search: Vec\u003cString\u003e = SearchBuilder::default()\n        .location(\"~/path/to/directory\")\n        .search_input(\"what to search\")\n        .more_locations(vec![\"/anotherPath/to/search\", \"/keepAddingIfYouWant/\"])\n        .limit(1000) // results to return\n        .ext(\"extension\")\n        .strict()\n        .depth(1)\n        .ignore_case()\n        .hidden()\n        .build()\n        .collect();\n\n    for path in search {\n        println!(\"{}\", path);\n    }\n}\n```\n\n- Sort the output by similarity with the input\n\n```rust\n use rust_search::{SearchBuilder, similarity_sort};\n fn main() {\n     let search_input = \"fly\";\n     let mut search: Vec\u003cString\u003e = SearchBuilder::default()\n         .location(\"~/Desktop/\")\n         .search_input(search_input)\n         .depth(1)\n         .ignore_case()\n         .build()\n        .collect();\n\n     similarity_sort(\u0026mut search, \u0026search_input);\n     for path in search {\n        println!(\"{:?}\", path);\n     }\n }\n \n```\n\u003e search **without** similarity sort\n`[\"afly.txt\", \"bfly.txt\", \"flyer.txt\", \"fly.txt\"]`\n\n\u003e search **with** similarity sort\n`[\"fly.txt\", \"flyer.txt\", \"afly.txt\", \"bfly.txt\",]`\n\n- To get all the files with a specific extension in a directory, use:\n\n```rust\nuse rust_search::SearchBuilder;\n\nlet files: Vec\u003cString\u003e = SearchBuilder::default()\n    .location(\"/path/to/directory\")\n    .ext(\"file_extension\")\n    .build()\n    .collect();\n```\n\n- To get all the files in a directory, use:\n\n```rust\nuse rust_search::SearchBuilder;\n\nlet files: Vec\u003cString\u003e = SearchBuilder::default()\n    .location(\"/path/to/directory\")\n    .depth(1)\n    .build()\n    .collect();\n```\nTo filter files by date_created, date_modified, file_size and/or custom_filter, use:\n\n```rust\nuse rust_search::{FileSize, FilterExt, SearchBuilder};\nuse std::time::{Duration, SystemTime};\n\nlet search: Vec\u003cString\u003e = SearchBuilder::default()\n\t\t.location(\"~/path/to/directory\")\n\t\t.file_size_greater(FileSize::Kilobyte(200.0))\n\t\t.file_size_smaller(FileSize::Megabyte(10.0))\n\t\t.created_after(SystemTime::now() - Duration::from_secs(3600 * 24 * 10))\n\t\t.created_before(SystemTime::now())\n\t\t.modified_after(SystemTime::now() - Duration::from_secs(3600 * 24 * 5))\n\t\t.custom_filter(|dir| dir.metadata().unwrap().is_file())\n\t\t.custom_filter(|dir| !dir.metadata().unwrap().permissions().readonly())\n\t\t.build()\n\t\t.collect();\n```\n\n👉 For more examples, please refer to the [Documentation](https://docs.rs/rust_search/latest/rust_search/)\n\n## ⚙️ Benchmarks\n\nThe difference in sample size is due to the fact that fd and glob are different tools and have different use cases. fd is a command line tool that searches for files and directories. glob is a library that can be used to search for files and directories. The benchmark is done on a MacBook Air M2, 16 GB Unified memory.\n\nBenchmarks are done using [hyperfine](https://github.com/sharkdp/hyperfine),\nBenchmarks files are available in the [benchmarks](https://drive.google.com/drive/folders/1ug6ojNixS5jAe6Lh6M0o2d3tku73zQ9w?usp=sharing) drive folder.\n\n### - Rust Search vs Glob\n\nThe benchmark was done on a directories containing 300K files.\n\n| Command / Library | Mean [s] | Min [s] | Max [s] | Relative |\n|:---|---:|---:|---:|---:|\n| `rust_search` | 1.317 ± 0.002 | 1.314 | 1.320 | 1.00 |\n| `glob` | 22.728 ± 0.023 | 22.690 | 22.746 | 17.25 ± 0.03 |\n\n---\n\n### - Rust Search vs FD\n\nThe benchmark was done on a directories containing 45K files.\n\n| Command / Library | Mean [ms] | Min [ms] | Max [ms] | Relative |\n|:---|---:|---:|---:|---:|\n| `rust_search` | 680.5 ± 2.1 | 678.3 | 683.6 | 1.00 |\n| `fd -e .js` | 738.7 ± 10.2 | 720.8 | 746.7 | 1.09 ± 0.02 |\n\n---\n\n### Results:-\n\n```diff\n+ rust_search is 17.25 times faster than Glob.\n\n+ rust_search** is 1.09 times faster than FD.\n```\n\n## 👨‍💻 Contributors\n\nAny contributions would be greatly valued as this library is still in its early stages.\n\n- Documentation\n- Benchmarks\n- Implementation guidelines\n- Code Improvement\n\nIf you want to contribute to this project, please follow the steps below:\n\n1. Fork the project\n2. Clone the forked repository\n3. Create a feature branch\n4. Make changes to the code\n5. Commit the changes\n6. Push the changes to the forked repository\n7. Create a pull request\n8. Wait for the pull request to be reviewed and merged (if approved)\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n## Discord server \u0026 Linkedin\n\nClick the button below to join the discord server or Linkedin\n\n\u003ca href=\"https://discord.gg/hqDPyNb9m3\" target=\"_blank\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/42001064/126635148-9a736436-5a6d-4298-8d8e-acda11aec74c.png\" alt=\"Join Discord Server\" width=\"180px\" \u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/in/parthjadhav04\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Linkedin-blue?style=flat-square\u0026logo=linkedin\" alt=\"Connect on Linkedin\" width=\"180px\" height=\"58\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthjadhav%2Frust_search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparthjadhav%2Frust_search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthjadhav%2Frust_search/lists"}