flexsearch
Next-generation full-text search library for Browser and Node.js
FlexSearch is a fast JavaScript library that adds full-text search to websites and apps, running entirely in the browser or Node.js with instant results and no server round-trip required.
FlexSearch is a JavaScript library that adds fast full-text search to websites and Node.js applications. Full-text search means users can type a word or phrase and the library finds all records containing that text, the same basic idea as what a search box on a website does. FlexSearch is built to do this very quickly, with benchmark numbers in the README showing it outperforming other JavaScript search libraries by large margins on both simple and complex queries.
You add FlexSearch to a project by installing it from npm, loading it in a browser, or importing it as a module. You then build an index by feeding it your data, such as a list of product names or article titles. After that, users can search that index in real time without any server round-trip. Everything runs in the browser or inside a Node.js process, which means search results appear instantly.
The library supports searching across multiple fields of a document at once, phonetic matching (so a typo or alternate spelling still finds the right result), partial word matching, tag-based filtering, and result highlighting so the matched text is visually marked in the output. For large datasets, the library can distribute work across browser web workers or Node.js threads so the main page stays responsive.
Version 0.8 added persistent indexes, meaning you can store the search index in a real database rather than only keeping it in memory. Supported storage backends include IndexedDB (built into the browser), Redis, SQLite, Postgres, MongoDB, and Clickhouse. This makes it practical to use on large catalogs where rebuilding the index from scratch on every page load would be too slow.
Language support goes beyond Latin characters. The library handles Chinese, Japanese, Korean, Arabic, Hindi, Cyrillic, Greek, Hebrew, and other scripts, so it is usable in multilingual applications. The full README is longer than what was shown.
Where it fits
- Add an instant search box to a product catalog or blog that finds results as the user types, with no backend call
- Build a multilingual search feature that handles Chinese, Arabic, Cyrillic, or Hebrew text alongside Latin characters
- Store a persistent search index in PostgreSQL or Redis so large catalogs do not need to rebuild from scratch on every page load