Skip to content

feat: add Unicode-aware expression indexes for German umlaut search#261

Merged
hf-kklein merged 1 commit into
mainfrom
fix/unicode-lower-indexes
Mar 30, 2026
Merged

feat: add Unicode-aware expression indexes for German umlaut search#261
hf-kklein merged 1 commit into
mainfrom
fix/unicode-lower-indexes

Conversation

@hf-kklein
Copy link
Copy Markdown
Contributor

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 existing lower() 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 existing lower() indexes.

Companion PR

Hochfrequenz/ahb-tabellen#798 updates the search queries to use the matching REPLACE expression.

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>
@hf-kklein hf-kklein requested a review from hf-mrdachner March 30, 2026 07:41
@hf-kklein hf-kklein enabled auto-merge (squash) March 30, 2026 07:43
@hf-kklein hf-kklein requested a review from hf-krechan March 30, 2026 07:46
@hf-kklein hf-kklein disabled auto-merge March 30, 2026 13:54
@hf-kklein hf-kklein merged commit c6d0b25 into main Mar 30, 2026
21 checks passed
@hf-kklein hf-kklein deleted the fix/unicode-lower-indexes branch March 30, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant