#fuzzy #search #lightweight #pattern #strsim

simsearch

A simple and lightweight fuzzy search engine that works in memory, searching for similar strings (a pun here)

8 releases

0.2.4 Feb 6, 2023
0.2.3 Apr 11, 2021
0.2.2 Dec 3, 2020
0.2.1 Jul 19, 2020
0.1.4 Apr 16, 2019

#229 in Text processing

Download history 1874/week @ 2022-12-07 1886/week @ 2022-12-14 2343/week @ 2022-12-21 1231/week @ 2022-12-28 1968/week @ 2023-01-04 1348/week @ 2023-01-11 3826/week @ 2023-01-18 2330/week @ 2023-01-25 2631/week @ 2023-02-01 2175/week @ 2023-02-08 1785/week @ 2023-02-15 1518/week @ 2023-02-22 145/week @ 2023-03-01 215/week @ 2023-03-08 646/week @ 2023-03-15 1377/week @ 2023-03-22

2,398 downloads per month
Used in 3 crates

MIT/Apache

18KB
210 lines

simsearch

Build Status crates.io docs.rs

A simple and lightweight fuzzy search engine that works in memory, searching for similar strings (a pun here).

Documentation

Usage

Add the following to your Cargo.toml:

[dependencies]
simsearch = "0.2"

Example

use simsearch::SimSearch;

let mut engine: SimSearch<u32> = SimSearch::new();

engine.insert(1, "Things Fall Apart");
engine.insert(2, "The Old Man and the Sea");
engine.insert(3, "James Joyce");

let results: Vec<u32> = engine.search("thngs");

assert_eq!(results, &[1]);

By default, Jaro-Winkler distance is used. An alternative Levenshtein distance, which is SIMD-accelerated but only works for ASCII byte strings, can be specified with custom SearchOptions:

use simsearch::{SimSearch, SearchOptions};

let options = SearchOptions::new().levenshtein(true);
let mut engine: SimSearch<u32> = SimSearch::new_with(options);

Also try the interactive demo by:

$ cargo run --release --example books

Contribution

All kinds of contribution are welcomed.

  • Issus. Feel free to open an issue when you find typos, bugs, or have any question.
  • Pull requests. New collection, better implementation, more tests, more documents and typo fixes are all welcomed.

License

Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Dependencies

~260–475KB