navidrome/db
Deluan 7bb2c0968f perf(search): speed up CJK search with NOCASE covering indexes
Queries containing CJK (and punctuation-only) text bypass FTS5 and fall back to
LIKE-based search, because the unicode61 tokenizer indexes whole space-free CJK
runs as single tokens and cannot substring-match them. That fallback had no usable
index, so each query did a full scan of the wide media_file table across four
columns — roughly 4 seconds on a one-million-track library.

Add COLLATE NOCASE covering indexes on exactly the columns the LIKE fallback
searches (likeSearchColumns), so SQLite scans the narrow per-column indexes instead
of the full table. A plain LIKE uses them because the server runs with
case_sensitive_like = OFF. Results are unchanged; only latency improves
(~4s to ~0.3s end-to-end). The FTS path for Latin/numeric queries is untouched.

A new test asserts every likeSearchColumns column has a matching NOCASE index in
the migrated schema, so the column set and the migration cannot silently drift.
2026-06-14 23:59:23 -04:00
..
migrations perf(search): speed up CJK search with NOCASE covering indexes 2026-06-14 23:59:23 -04:00
backup.go refactor(conf): replace eager dir creation with lazy Dir type (#5495) 2026-05-13 17:44:22 -03:00
backup_test.go refactor(conf): replace eager dir creation with lazy Dir type (#5495) 2026-05-13 17:44:22 -03:00
db.go fix(server): make DB PRAGMA optimize error non-fatal 2026-06-09 19:29:58 -04:00
db_test.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
export_test.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00