# nekosearch
[](https://crates.io/crates/nekosearch)
[](https://docs.rs/nekosearch)
[](https://github.com/pas2rust/nekosearch/blob/main/LICENSE)






**`NekoSearch`** is a small, focused fuzzy string comparator designed to produce a single, explainable similarity score from a weighted combination of multiple metrics. It’s useful for typo-tolerant matching, fuzzy lookup, autocomplete ranking, and any scenario where you want a compact similarity result plus the breakdown of contributing signals.
## ⚙️ Installation
Enable only the features you need:
```bash
cargo add nekosearch
```
## 🚀 Usage
```rust
use nekosearch::components::prelude::*;
const EPSILON: f64 = 0.00001;
#[test]
fn test_find_perfect_match() {
let neko = NekoSearch::new().target("Rust");
let result = neko.find("Rust");
assert!((result.score - 1.0).abs() < EPSILON);
}
#[test]
fn test_custom_weights() {
let neko = NekoSearch::new()
.target("martha")
.lev_weight(0.1)
.jaro_winkler_weight(0.8)
.n_gram_weight(0.1);
let result_low_lev = neko.find("marhta");
let neko_high_lev = NekoSearch::new()
.target("martha")
.lev_weight(0.8)
.jaro_winkler_weight(0.1)
.n_gram_weight(0.1);
let result_high_lev = neko_high_lev.find("marhta");
assert!(result_low_lev.score > result_high_lev.score);
}
#[test]
fn test_filter_method() {
let neko = NekoSearch::new().target("Rust");
let terms = vec!["Rost", "Java", "Python", "Rust"];
let results = neko.filter(terms);
assert_eq!(results.len(), 4);
let perfect_match = results.iter().find(|r| r.term == "Rust").unwrap();
assert!((perfect_match.score - 1.0).abs() < EPSILON);
let typo = results.iter().find(|r| r.term == "Rost").unwrap();
println!("typo: {:#?}", typo);
assert!(typo.score > 0.6);
assert!(typo.jaro_score > 0.8);
assert!(typo.lev_score > 0.6);
let non_match = results.iter().find(|r| r.term == "Java").unwrap();
assert!(non_match.score < 0.2);
}
```
# ❤️ Donate
[](https://github.com/pas2rust/pas2rust/blob/main/pas-monero-donate.png)
[](https://github.com/pas2rust/pas2rust/blob/main/pas-bitcoin-donate.png)