fix(db): split seed_info CTE so similar-artist works without seed genre
The combined seed_info CTE filtered the seed out when its genre was NULL/empty. Restored the spec's two-CTE design (seed_artist + seed_tags) so similar-artist matching works regardless of the seed's genre coverage. Drops the genre workaround from the SimilarArtist test.
This commit is contained in:
@@ -73,11 +73,6 @@ func TestLoadCandidatesFromSimilarity_LBSimilarSourceContributes(t *testing.T) {
|
||||
func TestLoadCandidatesFromSimilarity_SimilarArtistTracksContribute(t *testing.T) {
|
||||
f := newFixture(t, 1) // creates 1 artist + 1 album + 1 track (the seed)
|
||||
seed := f.tracks[0]
|
||||
// seed_info CTE only emits artist_id rows when genre is non-NULL (it
|
||||
// uses a LATERAL regexp_split_to_table join filtered by trim(g) <> '').
|
||||
// Give the seed a genre so that seed_info is populated and the
|
||||
// similar_artists JOIN can find artist_a_id = seed.ArtistID.
|
||||
helperSetTrackGenre(t, f, seed.ID, "Rock")
|
||||
// Add a SECOND artist + track in that artist; relate the two artists via artist_similarity.
|
||||
otherArtist, _ := f.q.UpsertArtist(context.Background(), dbq.UpsertArtistParams{Name: "OtherArtist", SortName: "OtherArtist"})
|
||||
otherAlbum, _ := f.q.UpsertAlbum(context.Background(), dbq.UpsertAlbumParams{Title: "OtherAlbum", SortTitle: "OtherAlbum", ArtistID: otherArtist.ID})
|
||||
|
||||
Reference in New Issue
Block a user