{"id":14110197,"url":"https://github.com/beowolx/haiku-search","last_synced_at":"2025-08-01T09:33:13.242Z","repository":{"id":238878107,"uuid":"797795305","full_name":"beowolx/haiku-search","owner":"beowolx","description":"Haiku-Search is a high-performance fuzzy search library designed for web applications. It is built using Rust and compiled to WebAssembly","archived":false,"fork":false,"pushed_at":"2024-05-14T07:06:45.000Z","size":75,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-15T22:12:15.354Z","etag":null,"topics":["bitma","fuzzy-search","javascript","n-grams","rust","wasm"],"latest_commit_sha":null,"homepage":"https://beowolx.github.io/haiku-search/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beowolx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-08T14:29:15.000Z","updated_at":"2024-09-29T14:25:49.000Z","dependencies_parsed_at":"2024-05-09T19:30:13.127Z","dependency_job_id":"bc7ae706-cdbd-42a5-a539-f494fa270abf","html_url":"https://github.com/beowolx/haiku-search","commit_stats":null,"previous_names":["beowolx/haiku","beowolx/haiku-search"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beowolx%2Fhaiku-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beowolx%2Fhaiku-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beowolx%2Fhaiku-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beowolx%2Fhaiku-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beowolx","download_url":"https://codeload.github.com/beowolx/haiku-search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228360654,"owners_count":17907950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitma","fuzzy-search","javascript","n-grams","rust","wasm"],"created_at":"2024-08-14T10:02:42.839Z","updated_at":"2024-12-05T19:31:37.057Z","avatar_url":"https://github.com/beowolx.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Haiku-Search\n\n[![Build Status](https://github.com/beowolx/haiku/actions/workflows/ci.yaml/badge.svg)](https://github.com/beowolx/haiku/actions)\n[![npm](https://img.shields.io/npm/v/haiku-search)](https://www.npmjs.com/package/haiku-search)\n\n## Overview\n\nHaiku-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.\n\n## Powered by Rust and WebAssembly\n\nHaiku-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.\n\n## Algorithms\n\nHaiku-Search implements two primary algorithms:\n\n- **N-gram Indexing**: This technique breaks down text into chunks (n-grams) and indexes them for quick lookup, allowing us to quickly narrow down potential matches.\n- **Bitap Algorithm**: For precise matching, Haiku-Search uses the [Bitap algorithm](https://en.wikipedia.org/wiki/Bitap_algorithm), which supports a configurable number of errors. It is effective for short to medium text lengths and allows for approximate string matching.\n\n## Installation\n\nTo install, just run:\n\n```bash\nnpm install haiku-search\n```\n\n## Usage Example\n\nHere is an example of how to use Haiku-Search without a bundler in your app:\n\n```js\nimport init, {\n  SearchEngine,\n} from \"./node_modules/haiku-search/haiku_search.js\";\n\nasync function demoHaikuSearch() {\n  // Initialize the WASM module, only needed if once and if not using a bundler\n  await init();\n  const data = [\"Apple Pie\", \"Banana Bread\", \"Carrot Cake\"];\n  const haikuEngine = new SearchEngine(data, {\n    ngram_size: 3,\n    max_distance: 1,\n  });\n\n  const query = \"Apple\";\n  const result = await haikuEngine.search(query);\n\n  console.log(\"Search result:\", result[0].text);\n  console.log(\"Score result:\", result[0].score);\n}\n\ndemoHaikuSearch();\n```\n\nCurrently, WASM modules are only supported by WebPack. So, if you want use Haiku-Search in a web application, you will have to use WebPack.\n\n## Performance Comparison to Fuse.js\n\nHaiku-Search is designed to be significantly faster than traditional JavaScript libraries like [Fuse.js](\u003c[url](https://www.fusejs.io/)\u003e). In benchmarks, Haiku-Search performs searches up to **13x faster than Fuse.js**.\n\n![image](https://github.com/beowolx/haiku/assets/61982523/3684be93-0eb6-4138-9e81-a02ccc5e99d5)\n\nYou can see this chart live here: [Haiku-Search vs Fuse.js Benchmark Results](https://beowolx.github.io/haiku-search/index.html).\n\n## Known Limitations\n\n- **Unicode Support**: Haiku-Search does not currently support unicode characters, which may limit its use in applications requiring internationalization.\n- **Pattern Length**: The Bitap algorithm used in Haiku-Search supports patterns up to 32 characters long due to limitations in handling bit masks.\n\n## Roadmap\n\n- Add unicode support\n- Improve memory footprint\n- Improve code documentation\n\n## Contributing\n\nContributions to Haiku-Search are welcome! If you're looking to contribute, please:\n\n- Check out the current issues on GitHub, especially those tagged as \"good first issue\".\n- Fork the repository and make your changes.\n- Write clear, commented code.\n- Ensure your changes pass all existing tests and add new tests for added functionality.\n- Submit a pull request with a detailed description of your changes.\n\nFor major changes, please open an issue first to discuss what you would like to change.\n\nThank you for your interest in improving Haiku-Search!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeowolx%2Fhaiku-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeowolx%2Fhaiku-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeowolx%2Fhaiku-search/lists"}