Full-text index
A full-text index is an index structure for efficient text retrieval. It lets you find documents quickly using keywords, phrases, or natural-language-style queries. Unlike classic database indexes (such as B-trees), full-text indexes target text: fuzzy matching, synonym-style behavior, tokenization, weighting, and other advanced search features.
Use cases
Full-text indexes fit typical scenarios such as:
- Enterprise knowledge bases: Large organizations store project docs, meeting notes, research reports, and similar material. Full-text search helps staff find information faster and more accurately.
- Online libraries and e-book platforms: Users can search by title, author, or passages inside books; the index returns matching content quickly.
- News portals and social sites: High daily volume of articles, posts, and comments. Full-text search filters the feed by topic, event, or people users care about.
- Legal document retrieval: Contracts, judgments, statutes, and other dense text. Strong full-text search speeds review and helps locate precedents, cited clauses, and related law.
- Healthcare information systems: Clinicians look up patient history, recent papers, and reference material. Full-text indexes make that access easier and support better clinical decisions.
Field reference
In seekdb-js, configure full-text indexes with FulltextIndexConfig.
FulltextIndexConfig fields for the tokenizer and parameters:
| Field | Type | Default | Description |
|---|---|---|---|
| analyzer | string / FulltextAnalyzer | "ik" | Tokenizer: space, ngram, ngram2, beng, ik, and others |
| properties | object | None | Keys are strings; values are str, int, float, or bool |
Different analyzer types support different properties. The following properties types are available:
- IkProperties
- SpaceProperties
- NgramProperties
- Ngram2Properties
- BengProperties
Different analyzers support different properties:
| analyzer | Supported properties | Default | Description |
|---|---|---|---|
| ik | ik_mode | "smart" | smart or max_word. |
| space | min_token_size | 3 | Range: [1 - 16] |
| space | max_token_size | 84 | Range: [10 - 84] |
| ngram | ngram_token_size | 2 | Range: [1 - 10] |
| ngram2 | min_ngram_size | Range: [1 - 16] | |
| ngram2 | max_ngram_size | Range: [1 - 16] | |
| beng | min_token_size | 3 | Range: [1 - 16] |
| beng | max_token_size | 84 | Range: [10 - 84] |
Usage
To use a full-text index in seekdb-js, configure it through Schema when you create a collection. If you do not set any schema fields, the collection defaults to a full-text index with the IK tokenizer.
Prerequisites
Install seekdb-js V1.2.0 or later.
npm install seekdb
Usage example
import { FullTextIndexConfig } from "seekdb";
const fulltextConfig = new FullTextIndexConfig(
analyzer: "ik", // Default: "ik"
properties?: FulltextAnalyzerPropertiesMap[T]
);