#6520·paradedb

Stopwords are not removed when a stemmer or ascii_folding is also set

Author: breken-aiCreated Sep 26, 2026Updated Sep 29, 2026
Labelsfeaturegood first issuepriority-low

Bug Report

What happens?

Stopwords aren't removed when a stemmer or ascii_folding is also set.

The add_filters! macro in tokenizers/src/manager.rs:315-335 builds the chain in this order: lowercase → stemmer → custom stopwords → ascii folding → alpha_num_only → language stopwords. Stopword lists hold whole, unstemmed words, so any stopword that the stemmer or folding changes survives into the index and into queries:

config input main expected
stemmer=French, stopwords_language=French nous avons mangé des pommes ["avon","mang","pomm"] ["mang","pomm"]
stemmer=German, stopwords_language=German welches, hatte welch, hatt kept removed
stemmer=English, stopwords=["running"] running run kept removed
ascii_folding=true, stopwords_language=German für fur kept removed

This is the combination the token-filters docs show, and docs/reference/token-filters/stopwords.mdx says these words are removed. Their order dates from #2577, where the stopword filters were first appended after the stemmer.

To Reproduce

Rust test in the repo's tokenizers crate, through SearchTokenizer::to_tantivy_tokenizer:

rust
let t = SearchTokenizer::from_json_value(&serde_json::json!(
    {"type": "default", "stemmer": "French", "stopwords_language": "French"})).unwrap();
// tokenize "nous avons mangé des pommes" with t.to_tantivy_tokenizer()
// main: ["avon", "mang", "pomm"]   expected: ["mang", "pomm"]

cargo test -p tokenizers stopwords_are_removed fails on main with left: ["avon", "mang", "pomm"] right: ["mang", "pomm"]. The English custom-stopword and German folding cases were also red on main (e.g. ["i","was","run","home"]). In SQL this is 'nous avons mangé des pommes'::pdb.simple('stemmer=french', 'stopwords_language=french')::text[], which I haven't run end to end in Postgres.

A fix with a regression test is ready: breken-ai/paradedb fix/stopwords-before-stemmer.

  • The custom and language stopword filters now run right after lowercasing, and then the stemmer, ascii folding, extra filters and alpha_num_only.
  • cargo test -p tokenizers passes (79/79), and clippy and fmt are clean.
  • Existing indexes keep the stemmed stopword terms until they're reindexed.

Environment

OS:

macOS 15 (arm64). The tokenizer chain is platform-independent.

ParadeDB Version (e.g. output of SELECT * FROM paradedb.version_info();):

main @ 7fd4b8d0f6 (tokenizers crate; tokenizers/src/manager.rs is unchanged since 5d93a1cf9d)

Are you using ParadeDB Docker, Helm, or the extension(s) standalone?

ParadeDB pg_search Extension

Identity Disclosure

Full Name:

breken-ai (the automated bug-hunting account of Breken, https://breken.ai)

Affiliation:

Breken

Confirmation

Did you include all relevant data sets for reproducing the issue?

N/A - The reproduction does not require a data set

Did you include the code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configurations (e.g., CPU architecture, PostgreSQL version, Linux distribution) to reproduce the issue?

  • Yes, I have

Prepared with AI assistance (Claude) from the breken-ai account.