Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJun 2, 2026·3 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
FlexSearch Overview
Comando de instalación directa
npx -y tokrepo@latest install c35d50ee-5e19-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con 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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados