Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJun 2, 2026·3 min de lecture

FlexSearch — Next-Generation Full-Text Search for Browser and Node.js

A high-performance full-text search library for JavaScript that runs in the browser and Node.js with zero dependencies.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
FlexSearch Overview
Commande d'installation directe
npx -y tokrepo@latest install c35d50ee-5e19-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

FlexSearch is a full-text search library for JavaScript that provides memory-efficient indexing and sub-millisecond query performance. It runs in both browser and Node.js environments with zero external dependencies, making it suitable for client-side search in web applications and server-side indexing.

What FlexSearch Does

  • Indexes and searches text content with configurable tokenizers and scoring
  • Supports async processing and Web Worker offloading for non-blocking search
  • Provides document-based indexing with field-specific search and tag filtering
  • Enables persistent storage through export and import of index data
  • Offers multiple built-in language presets and custom encoder support

Architecture Overview

FlexSearch uses a context-based scoring algorithm that builds an inverted index with positional context for each indexed term. The library stores index data in a compact trie structure optimized for memory efficiency. Queries are resolved by intersecting matching result sets across context layers, with configurable resolution depth controlling the trade-off between precision and speed.

Self-Hosting & Configuration

  • Install via npm or include as a script tag for browser usage
  • Configure charset encoding, tokenizer mode (strict, forward, reverse, full), and resolution
  • Use the Document class for multi-field indexing with per-field options
  • Enable Web Worker mode by setting worker count in the constructor
  • Export index state to JSON for persistence and restore on application restart

Key Features

  • Sub-millisecond search on datasets with hundreds of thousands of documents
  • Context-based relevance scoring without external ranking dependencies
  • Built-in support for 12 languages with phonetic matching and accent handling
  • Zero dependencies and under 6 KB gzipped for the compact build
  • Incremental indexing with efficient add, update, and remove operations

Comparison with Similar Tools

  • Lunr.js — Simpler API but slower on large datasets and lacks Web Worker support
  • Fuse.js — Fuzzy search focused; not a full inverted index so less precise on exact matches
  • MiniSearch — Similar feature set but FlexSearch offers more tokenizer options and context scoring
  • Elasticsearch — Server-based distributed engine; overkill for client-side or embedded use cases

FAQ

Q: Can FlexSearch run entirely in the browser? A: Yes, it requires no backend and runs in any modern browser with optional Web Worker support.

Q: How large a dataset can FlexSearch handle? A: It efficiently indexes hundreds of thousands of documents in-memory; exact limits depend on available RAM.

Q: Does FlexSearch support fuzzy matching? A: It supports phonetic encoding and configurable tokenizer modes but is not primarily a fuzzy search library.

Q: Can I persist the index across page reloads? A: Yes, use the export/import methods to serialize the index to localStorage, IndexedDB, or a file.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires