Skip to main content
Version: V1.4.0

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:

FieldTypeDefaultDescription
analyzerstring / FulltextAnalyzer"ik"Tokenizer: space, ngram, ngram2, beng, ik, and others
propertiesobjectNoneKeys 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:

analyzerSupported propertiesDefaultDescription
ikik_mode"smart"smart or max_word.
spacemin_token_size3Range: [1 - 16]
spacemax_token_size84Range: [10 - 84]
ngramngram_token_size2Range: [1 - 10]
ngram2min_ngram_sizeRange: [1 - 16]
ngram2max_ngram_sizeRange: [1 - 16]
bengmin_token_size3Range: [1 - 16]
bengmax_token_size84Range: [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]
);