#fuzzy-search #fuzzy-string #search-engine #string-search #search #edit-distance #search-pattern

simsearch

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

9 releases

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

#225 in Algorithms

Download history 2159/week @ 2024-07-21 1751/week @ 2024-07-28 2010/week @ 2024-08-04 1580/week @ 2024-08-11 1472/week @ 2024-08-18 940/week @ 2024-08-25 1531/week @ 2024-09-01 1226/week @ 2024-09-08 927/week @ 2024-09-15 1148/week @ 2024-09-22 567/week @ 2024-09-29 1048/week @ 2024-10-06 960/week @ 2024-10-13 1273/week @ 2024-10-20 1838/week @ 2024-10-27 1172/week @ 2024-11-03

5,399 downloads per month
Used in 6 crates

MIT/Apache

19KB
208 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

~270–435KB