mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-22 01:07:27 +02:00
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. |
||
|---|---|---|
| .. | ||
| migrations | ||
| backup.go | ||
| backup_test.go | ||
| db.go | ||
| db_test.go | ||
| export_test.go | ||