Haiku-Search is a high-performance fuzzy search library designed for web applications. It is built using Rust and compiled to WebAssembly, providing lightning-fast search capabilities directly in the browser. This combination allows Haiku-Search to execute complex search algorithms efficiently, taking advantage of Rust's performance and safety features.
Haiku-Search leverages the power of Rust and WebAssembly to run directly in web browsers, offering significant performance improvements over traditional JavaScript search libraries. By compiling to WebAssembly, Haiku-Search provides near-native speed, making it ideal for applications requiring quick search responses on large datasets.
Haiku-Search implements two primary algorithms:
To install, just run:
npm install haiku-search
Here is an example of how to use Haiku-Search without a bundler in your app:
import init, {
SearchEngine,
} from "./node_modules/haiku-search/haiku_search.js";
async function demoHaikuSearch() {
// Initialize the WASM module, only needed if once and if not using a bundler
await init();
const data = ["Apple Pie", "Banana Bread", "Carrot Cake"];
const haikuEngine = new SearchEngine(data, {
ngram_size: 3,
max_distance: 1,
});
const query = "Apple";
const result = await haikuEngine.search(query);
console.log("Search result:", result[0].text);
console.log("Score result:", result[0].score);
}
demoHaikuSearch();
Currently, WASM modules are only supported by WebPack. So, if you want use Haiku-Search in a web application, you will have to use WebPack.
Haiku-Search is designed to be significantly faster than traditional JavaScript libraries like Fuse.js. In benchmarks, Haiku-Search performs searches up to 13x faster than Fuse.js.
You can see this chart live here: Haiku-Search vs Fuse.js Benchmark Results.
Contributions to Haiku-Search are welcome! If you're looking to contribute, please:
For major changes, please open an issue first to discuss what you would like to change.
Thank you for your interest in improving Haiku-Search!
$ claude mcp add haiku-search \
-- python -m otcore.mcp_server <graph>