Add an opt-in option to lowercase filter values

Filter values that only differ in case, like `Mint` and `mint`, came
through as separate values. The new `--lowercase-filters` option
(`lowercase_filters`, `PAGEFIND_LOWERCASE_FILTERS`, and
`lowercaseFilters` / `lowercase_filters` in the Node and Python
wrappers) lowercases filter values when indexing and merges values on
a page that become equal. Filter names are left as they are. Off by
default.

Fixes #737
This commit is contained in:
dualfroz committed 2026-10-03 01:43:17 +02:00
1 parent 1308f3c1bb
commit 3a1d31147a
12 files changed
+176

No files matched your search

+9
View File
@@ -121,6 +121,15 @@ This defaults to false, so playground files are not written to your live site. P
|----------------------|--------------------|--------------------|
| `--write-playground` | `PAGEFIND_WRITE_PLAYGROUND` | `write_playground` |
### Lowercase filters
Lowercases all filter values when indexing, so that values differing only in case are merged. With this option, `<span data-pagefind-filter="garnish">Mint</span>` and `<span data-pagefind-filter="garnish">mint</span>` both come through as the `mint` value of the `garnish` filter. Filter names are left as they are.
Filter values passed to Pagefind search should then be lowercase too, and any UI that displays them will show the lowercased values.
| CLI Flag | ENV Variable | Config Key |
|-----------------------|------------------------------|---------------------|
| `--lowercase-filters` | `PAGEFIND_LOWERCASE_FILTERS` | `lowercase_filters` |
### Verbose
Prints extra logging while indexing the site. Only affects the CLI, does not impact web-facing search.
+1
View File
@@ -64,6 +64,7 @@ const { index } = await pagefind.createIndex({
excludeSelectors: [".my-code-blocks"],
forceLanguage: "en",
includeCharacters: "._",
lowercaseFilters: false,
keepIndexUrl: false,
writePlayground: false,
verbose: false,
+1
View File
@@ -131,6 +131,7 @@ config = IndexConfig(
exclude_selectors=["nav"],
force_language="en",
include_characters="._",
lowercase_filters=False,
verbose=True,
logfile="index.log",
keep_index_url=True,