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
pyseekdb fits 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 pyseekdb, configure full-text indexes with FulltextIndexConfig.
FulltextIndexConfig fields:
| Field | Type | Default | Description |
|---|---|---|---|
| analyzer | str / FulltextAnalyzer | "ik" | Tokenizer: space, ngram, ngram2, beng, ik, and others |
| properties | dict | None | Keys are strings; values are str, int, float, or bool |
Different analyzer values support different properties. The following analyzer property types exist:
- IKProperties
- SpaceProperties
- NgramProperties
- Ngram2Properties
- BengProperties
Supported properties by analyzer:
| 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 pyseekdb, 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 pyseekdb V1.2.0 or later.
pip install -U pyseekdb
Usage example
from pyseekdb import (
Client, Schema,
FulltextIndexConfig,
)
client = Client(host="127.0.0.1", port=2881, database="test")
schema = Schema(
fulltext_index=FulltextIndexConfig(analyzer="ik", properties={"ik_mode": "smart"})
)
collection = client.create_collection("my_collection", schema=schema)