feat: #130 support accent-insensitive album and artist search via PostgreSQL unaccent #139
+1,063
−12
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.
Closes #130
What was done
server/drizzle/0008_unaccent-search.sql,_journal.json,0008_snapshot.json):CREATE EXTENSION IF NOT EXISTS unaccent;.public.simple_unaccenttext search configuration (copied frompg_catalog.simple) and mapshword,hword_part,word,numword, andhword_numpartthroughunaccent, pg_catalog.simple.set_album_search_vector()to build weighted title (A) and artist (B) vectors with'public.simple_unaccent'.album.search_vectorrows viaUPDATE album SET title = title;.server/src/search/search.ts):tsQuery()to tokenize withto_tsvector('public.simple_unaccent', $1), preserving:*prefix matching and GIN index usage onalbum_search_vector_idx.server/src/search/search.test.ts,server/src/search/search.postgres.test.ts):'public.simple_unaccent'.album/artist/album_artistrows populated byset_album_search_vector()(bjork/bjor->Björk,cafe/café->Café del Mar,royksopp->Röyksopp,beyonce->Beyoncé,jose merce/jose mer->José Mercé, plus title-vs-artist rank weighting).README.md):README.md:272-274so accent-sensitive search is no longer listed as a limitation while keeping the accurate note for non-Latin scripts.What was tested
Verified against a local throwaway PostgreSQL cluster:
DATABASE_URL="$TEST_DATABASE_URL" pnpm --filter @t19/server db:migrate(fresh + idempotent re-run) →Migrations applied.DATABASE_URL="$TEST_DATABASE_URL" pnpm --filter @t19/server db:import:musicbrainz→ succeededEXPLAINverifiedBitmap Index Scan on album_search_vector_idxpnpm --filter @t19/server exec vitest run→ 16/16 test files, 218/218 tests passed (search.postgres.test.ts: 26 passed)node server/scripts/assert-postgres-tests.mjs→ all 6 database-backed suites executed