Add unaccent to trigram GIN indexes for accent-insensitive search#4
Merged
jakebromberg merged 1 commit intomainfrom Feb 14, 2026
Merged
Add unaccent to trigram GIN indexes for accent-insensitive search#4jakebromberg merged 1 commit intomainfrom
jakebromberg merged 1 commit intomainfrom
Conversation
Queries for "Bjork" now match "Björk" at the database level. Adds an immutable f_unaccent() wrapper (required because the built-in unaccent() is STABLE) and updates all 4 trigram index expressions from lower(col) to lower(f_unaccent(col)). - schema/create_database.sql: enable unaccent extension - schema/create_functions.sql: immutable f_unaccent() wrapper - schema/create_indexes.sql: accent-insensitive index expressions - scripts/dedup_releases.py: update hardcoded post-dedup indexes - scripts/run_pipeline.py: run create_functions.sql after schema - scripts/verify_cache.py: run create_functions.sql on target DB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
f_unaccent()SQL wrapper (required because PostgreSQL's built-inunaccent()isSTABLE, notIMMUTABLE, so it can't be used in index expressions directly)lower(col)tolower(f_unaccent(col))Test plan
pytest -m postgres) -- verify schema, indexes, dedup, copy-to on Postgrespytest -m e2e) -- full pipeline runSELECT indexdef FROM pg_indexes WHERE indexname LIKE '%trgm%'showsf_unaccentSELECT f_unaccent('Björk')returnsBjorkNote: consumer queries in request-parser's
cache_service.pywill need a separate change to uselower(f_unaccent($1))in WHERE clauses to match the new index expressions.