proper alignment of filters

This commit is contained in:
Boof2015
2026-08-02 23:14:15 -04:00
parent 9153d91ccf
commit de27a4439d
6 changed files with 101 additions and 30 deletions
@@ -906,6 +906,10 @@ interface CatalogDao {
groupingMode: String,
): List<ArtistSummaryEntity>
// 'song' only: an album the artist merely guests on (a Various Artists
// compilation carrying one of their tracks) is not one of their albums. Those
// tracks are already reachable through the detail page's "Appears On" section,
// which reads the 'appearance' half of the same index.
@Query(
"""
SELECT DISTINCT a.*
@@ -916,6 +920,7 @@ interface CatalogDao {
AND i.revision = :revision
AND i.grouping_mode = :groupingMode
AND i.artist_key = :artistKey
AND i.relationship = 'song'
ORDER BY a.latest_added_at DESC, a.name_sort_key, a.identity_key
LIMIT :limit OFFSET :offset
""",
@@ -936,6 +941,7 @@ interface CatalogDao {
WHERE i.revision = :revision
AND i.grouping_mode = :groupingMode
AND i.artist_key = :artistKey
AND i.relationship = 'song'
""",
)
suspend fun countArtistAlbums(
@@ -260,13 +260,20 @@ object CatalogReadModelBuilder {
} else {
canonicalArtistNames(track)
}
val primaryKey = normalizeKey(primary)
for (name in names) {
val key = normalizeKey(name)
if (key.isEmpty()) continue
val isPrimary = key == primaryKey
val aggregate = aggregates.getOrPut(key) { Aggregate(name) }
aggregate.trackCount += 1
if (key == normalizeKey(primary)) aggregate.primaryCount += 1
aggregate.albumKeys += row.identityKey
if (isPrimary) {
aggregate.primaryCount += 1
// Albums the artist only guests on are not their albums; counting
// them here credited a Various Artists compilation to every featured
// performer. Artwork stays ungated so those artists keep a mosaic.
aggregate.albumKeys += row.identityKey
}
val current = aggregate.artworkTrack
if (track.artworkHash != null && (current == null || newerArtwork(track, current))) {
aggregate.artworkTrack = track
@@ -277,7 +284,7 @@ object CatalogReadModelBuilder {
groupingMode = mode,
artistKey = key,
trackId = track.id,
relationship = if (key == normalizeKey(primary)) "song" else "appearance",
relationship = if (isPrimary) "song" else "appearance",
)
}
}