feat(search): search ignores accents
- A search key apart from the key that identifies artists, albums and tracks: lower case, accents taken off (Latin, Greek and Cyrillic marks only, so kana and Hangul stay intact), and letters like ß, æ, ø, ł written plain. - GET /artists, /albums and /tracks look in it, so "bjork" finds "Björk" and "strasse" finds "Straße". - "Beyoncé" and "Beyonce" stay two artists: the identity key keeps accents. - Migration 0016 adds the column on SQLite and PostgreSQL; RefreshMatchKeys fills it for existing rows at start. - golang.org/x/text is now a direct dependency.
This commit is contained in:
parent
bea1158e68
commit
271c88743c
2 changed files with 265 additions and 73 deletions
8
migrations/postgres/0016_search_keys.sql
Normal file
8
migrations/postgres/0016_search_keys.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- A key for searching, apart from the keys that identify artists, albums and tracks: it has
|
||||
-- the accents taken off, so "bjork" finds "Björk", while "Beyoncé" and "Beyonce" stay two
|
||||
-- artists. It is computed in Go (Unicode-aware) and filled in for existing rows at start,
|
||||
-- by RefreshMatchKeys.
|
||||
|
||||
ALTER TABLE artists ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE albums ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE tracks ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
8
migrations/sqlite/0016_search_keys.sql
Normal file
8
migrations/sqlite/0016_search_keys.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- A key for searching, apart from the keys that identify artists, albums and tracks: it has
|
||||
-- the accents taken off, so "bjork" finds "Björk", while "Beyoncé" and "Beyonce" stay two
|
||||
-- artists. It is computed in Go (Unicode-aware) and filled in for existing rows at start,
|
||||
-- by RefreshMatchKeys.
|
||||
|
||||
ALTER TABLE artists ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE albums ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE tracks ADD COLUMN search_key TEXT NOT NULL DEFAULT '';
|
||||
Loading…
Reference in a new issue