Skip to main content

Tokenizers

By default, text columns are tokenized using the unicode tokenizer, which splits text according to the Unicode segmentation standard. Because index creation is a time-consuming operation, we recommend experimenting with the available tokenizers to find the most suitable one before running CREATE INDEX. For instance, if a column contains multiple languages, the ICU tokenizer may be more appropriate.

Token Filters

After tokens are created, token filters can be configured to apply further processing like lowercasing, stemming, or unaccenting. For example, the following code block adds English stemming to description:

BM25 Parameters

Tuning BM25 parameters is not necessary for most use cases.
BM25 uses two parameters, k1 and b, to control how term frequency and field length affect relevance scores. You can configure them independently for each field when creating an index. Pass k1 and b as options to a field’s tokenizer. In this example, the description field uses lower values to reduce the influence of repeated terms and field length. The category field gives repeated terms more weight while keeping the default length normalization.
You can set either parameter on its own or both together. Omitted parameters keep their defaults, and queries automatically use the values configured in the index.

Faster BM25 Queries

This feature is available in versions 0.26.0 and above.
Top K queries ordered by BM25 score can be sped up by setting pnorms=true when creating your index, at the cost of a larger index and longer builds.

Enable the Optimization

Set pnorms=true on the tokenizer cast for each text field used in BM25 scoring. The option defaults to false. This example enables it for description:
Queries automatically use the setting from the index:
This option is only supported for text fields. Existing indexes must be rebuilt with pnorms=true to enable it.

Performance Tradeoff

BM25 scoring uses the length of each text field to help determine relevance. Setting pnorms=true stores an extra, denser copy of this information where the scoring process can read it more efficiently. Depending on the data and query, this can make queries several times faster without changing scores or relevance ranking. For each field with pnorms enabled, the extra storage is roughly one byte per distinct term in each document, plus metadata. The extra data also increases the work required to build and merge index segments. Enable pnorms on fields where faster BM25 top K queries justify those costs.

Faster Counts

This feature is available in versions 0.26.2 and above. Indexes built before 0.26.2 must be rebuilt to receive this optimization.
ParadeDB can speed up eligible COUNT(*) queries that combine common search terms with AND or OR by storing additional bitmap structures.

Index Configuration

The bitmap_postings option on a tokenizer cast defaults to true. It is enabled by default because the storage overhead is usually very small. If your workload does not require counts, you can disable it for a field with bitmap_postings=false: