fix: always write artist row in index to prevent redundant re-indexing

indexOneArtist only wrote the artist entry when aliases were non-empty.
Artists without MB aliases (common for smaller/niche artists) never got
an entity_type='artist' row, so indexedArtistMBIDs() couldn't see them.
filterUnindexed then treated them as new on every startup, triggering
redundant LB API calls for top-release-groups and top-recordings.

Now the artist row is always written, with aliases as an empty string
when none exist. Subsequent builds will correctly skip these artists.
This commit is contained in:
2026-03-29 16:11:30 -04:00
parent 10d016f9d7
commit 7472e31545
+13 -13
View File
@@ -1195,21 +1195,21 @@ func (si *SearchIndex) indexOneArtist(
wg.Wait()
// Extract aliases from the now-cached MB rels (populated by
// the image resolution above) and update the artist's index entry.
// Write the artist entry into the index so indexedArtistMBIDs()
// recognises this artist as processed on subsequent builds.
// Also stores aliases from the now-cached MB rels (populated
// by the image resolution above) for FTS search.
if si.artistImg != nil {
aliases := si.artistImg.GetAliases(artist.ArtistMBID)
if aliases != "" {
si.writeBatch([]SearchIndexResult{{
EntityType: "artist",
MBID: artist.ArtistMBID,
Title: artist.ArtistName,
ArtistName: artist.ArtistName,
ArtistMBID: artist.ArtistMBID,
Popularity: artist.ListenCount,
Aliases: aliases,
}})
}
si.writeBatch([]SearchIndexResult{{
EntityType: "artist",
MBID: artist.ArtistMBID,
Title: artist.ArtistName,
ArtistName: artist.ArtistName,
ArtistMBID: artist.ArtistMBID,
Popularity: artist.ListenCount,
Aliases: aliases,
}})
}
// Batch write discography results.