Files
pipu-music/services/api/internal/search/translit_test.go
T
mrleo1nidandClaude Opus 5.5 c1160cccd3
ci / api / api (push) Successful in 27s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m1s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 34s
ci / ts / ts (packages + web) (push) Successful in 1m1s
ci / docker / docker (образы собираются — их сервер собирает сам при обновлении) (push) Successful in 25s
feat(api): search with Meilisearch (M2)
- artists, albums and tracks indexes are rebuilt from PostgreSQL next
  to the live ones and swapped in, so search keeps working; a rebuild
  runs on start, after every scan and when a source is removed
- transliteration fields (Кино ↔ kino) and a retry in the other
  keyboard layout (ghbdtn → привет) reported as corrected_query
- /search/suggest (3 artists, 3 albums, 5 tracks), /search by type
  with cursor pages, /admin/search/reindex; Meilisearch is part of
  /readyz
- found ids are hydrated from the catalog, so a lagging index never
  returns deleted entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 06:51:50 +03:00

23 lines
604 B
Go

package search
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTranslit(t *testing.T) {
assert.Equal(t, "kino", Translit("Кино"))
assert.Equal(t, "shchedrin", Translit("Щедрин"))
assert.Equal(t, "кино", Translit("Kino"))
assert.Equal(t, "щедрин", Translit("shchedrin"))
assert.Equal(t, "", Translit("1984"))
}
func TestSwitchLayout(t *testing.T) {
assert.Equal(t, "привет", SwitchLayout("ghbdtn"))
assert.Equal(t, "hello", SwitchLayout("руддщ"))
assert.Equal(t, "кино", SwitchLayout("rbyj"))
assert.Equal(t, "", SwitchLayout("123"))
}