feat: add Unicode-aware expression indexes for German umlaut search#261
Merged
Conversation
SQLite's LOWER() only handles ASCII — LOWER('Ä') returns 'Ä', not 'ä'.
Add expression indexes using REPLACE(REPLACE(REPLACE(LOWER(...), 'Ä', 'ä'),
'Ö', 'ö'), 'Ü', 'ü')) for all columns used in ahb-tabellen search.
These indexes enable the LIKE optimization for prefix queries (startsWith)
when the search code uses the matching REPLACE expression. Substring queries
(%pattern%) always do full scans regardless of indexes.
Related: Hochfrequenz/ahb-tabellen#790
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Add expression indexes using
REPLACE(REPLACE(REPLACE(LOWER(...), 'Ä', 'ä'), 'Ö', 'ö'), 'Ü', 'ü'))for all columns used in ahb-tabellen's global search.Why
SQLite's
LOWER()only handles ASCII. The existinglower()expression indexes storeÄas uppercase, which doesn't match when the search pattern uses lowercaseä(from JavaScript's correct.toLowerCase()). See Hochfrequenz/ahb-tabellen#790.These indexes enable SQLite's LIKE optimization for prefix queries (
startsWith) when ahb-tabellen uses the matching REPLACE expression in its queries.Columns indexed
beschreibung,segmentgroup_id,segment_id,dataelement_id,code_description,code_value,line_ahb_status,line_name— matching the 8 existinglower()indexes.Companion PR
Hochfrequenz/ahb-tabellen#798 updates the search queries to use the matching REPLACE expression.