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
+4 -4
View File
@@ -1195,11 +1195,12 @@ func (si *SearchIndex) indexOneArtist(
wg.Wait() wg.Wait()
// Extract aliases from the now-cached MB rels (populated by // Write the artist entry into the index so indexedArtistMBIDs()
// the image resolution above) and update the artist's index entry. // 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 { if si.artistImg != nil {
aliases := si.artistImg.GetAliases(artist.ArtistMBID) aliases := si.artistImg.GetAliases(artist.ArtistMBID)
if aliases != "" {
si.writeBatch([]SearchIndexResult{{ si.writeBatch([]SearchIndexResult{{
EntityType: "artist", EntityType: "artist",
MBID: artist.ArtistMBID, MBID: artist.ArtistMBID,
@@ -1210,7 +1211,6 @@ func (si *SearchIndex) indexOneArtist(
Aliases: aliases, Aliases: aliases,
}}) }})
} }
}
// Batch write discography results. // Batch write discography results.
all := make([]SearchIndexResult, 0, len(rgs)+len(recs)) all := make([]SearchIndexResult, 0, len(rgs)+len(recs))