Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt

Use this file to discover all available pages before exploring further.

LanceDB provides performant full-text search based on BM25, allowing you to incorporate keyword-based search in your retrieval solutions. This page shows examples on how to create and configure FTS indexes in LanceDB OSS and Enterprise, using the synchronous and asynchronous APIs.
In LanceDB Enterprise, create_fts_index API returns immediately, but index building happens asynchronously.

Creating FTS Indexes

Synchronous API

Use create_fts_index with synchronous LanceDB connections: Check FTS index status using the API:

Asynchronous API

When using async connections (connect_async), use create_index with the FTS configuration:
The create_fts_index method is not available on AsyncTable. Use create_index with FTS config instead.

Configuration Options

FTS Parameters

ParameterTypeDefaultDescription
with_positionboolFalseStore token positions (required for phrase queries)
base_tokenizerstr"simple"Text splitting method (simple, whitespace, or raw)
languagestr"English"Language for stemming/stop words
max_token_lengthint40Maximum token size; longer tokens are omitted
lower_caseboolTrueLowercase tokens
stemboolTrueApply stemming (runningrun)
remove_stop_wordsboolTrueDrop common stop words
ascii_foldingboolTrueNormalize accented characters
custom_stop_wordslist[str]NoneExtra stop words to drop in addition to the language defaults. Requires remove_stop_words=True.
min_ngram_lengthint3Minimum n-gram length. Applies only when base_tokenizer="ngram".
max_ngram_lengthint3Maximum n-gram length. Applies only when base_tokenizer="ngram".
prefix_onlyboolFalseIndex only prefix n-grams rather than all substrings. Applies only when base_tokenizer="ngram".
  • max_token_length can filter out base64 blobs or long URLs.
  • Disabling with_position reduces index size but disables phrase queries.
  • ascii_folding helps with international text (e.g., “café” → “cafe”).

Phrase Query Configuration

Enable phrase queries by setting:
ParameterRequired ValuePurpose
with_positionTrueTrack token positions for phrase matching
remove_stop_wordsFalsePreserve stop words for exact phrase matching