quickmatch
Fast fuzzy string matching for Rust and JavaScript.
Built for autocomplete, command palettes, and search-as-you-type interfaces.
Install
# rust
# js
Usage
Rust
use ;
let items = vec!;
let qm = new;
qm.matches; // ["file_name", "file_size"]
qm.matches; // ["file_name", "file_size"] (compound match)
qm.matches; // ["file_name", "file_size"] (trigram fuzzy)
// Custom config
let config = new
.with_limit
.with_trigram_budget
.with_separators;
let qm = new_with;
JavaScript
import from "quickmatch-js";
const items = ;
const qm = ;
qm.; // ["file_name", "file_size"]
qm.; // ["file_name", "file_size"] (compound match)
qm.; // ["file_name", "file_size"] (trigram fuzzy)
// Custom config
const config =
.
.
.;
const qm2 = ;
How it works
Queries go through three matching stages:
- Word match — query is split by separators and looked up in a word index
- Compound match — adjacent words are indexed as compounds, so
hashratefindshash_rate - Trigram fallback — unknown words are matched via character trigrams for fuzzy/typo tolerance
Results are ranked by prefix score (exact > prefix > unordered), then by trigram score, then by length.
Config
All options are documented in the QuickMatchConfig source. Builder methods:
| Rust | JS | Default |
|---|---|---|
with_limit(n) |
withLimit(n) |
100 |
with_trigram_budget(n) |
withTrigramBudget(n) |
6 |
with_min_score(n) |
withMinScore(n) |
2 |
with_separators(&[..]) |
withSeparators(s) |
_- :/ |
Performance
Benchmarked against ~5,000 metric names, 83 queries, averaged over 10K iterations:
| Avg/query | Build time | |
|---|---|---|
| Rust | ~26 us | ~40 ms |
| JS | ~29 us | ~30 ms |
License
MIT