diff --git a/backend/explore/explore.go b/backend/explore/explore.go index cdc0897..8d03875 100644 --- a/backend/explore/explore.go +++ b/backend/explore/explore.go @@ -1090,6 +1090,9 @@ func boostNameMatches(query string, result *MBSearchResult) { } // Boost artists whose name contains the full query. + // Within the same tier, sort by original MB relevance score + // (not the library-boosted blended score) so the most globally + // relevant exact match ranks first. if len(result.Artists) > 1 { sort.SliceStable(result.Artists, func(i, j int) bool { iMatch := nameMatchTier(q, strings.ToLower(result.Artists[i].Name)) @@ -1099,7 +1102,12 @@ func boostNameMatches(query string, result *MBSearchResult) { return iMatch < jMatch // lower tier = better match } - return false // preserve existing order within same tier + // Within same tier, prefer higher blended score. + if result.Artists[i].Score != result.Artists[j].Score { + return result.Artists[i].Score > result.Artists[j].Score + } + + return false // preserve existing order as last resort }) } diff --git a/backend/explore/musicbrainz.go b/backend/explore/musicbrainz.go index 01c20a3..e294ef1 100644 --- a/backend/explore/musicbrainz.go +++ b/backend/explore/musicbrainz.go @@ -378,6 +378,7 @@ func convertArtist(a musicbrainzws2.Artist) MBArtist { Country: string(a.CountryCode), Disambiguation: a.Disambiguation, Score: a.Score, + OriginalScore: a.Score, } // Extract the primary English alias when the canonical name diff --git a/backend/explore/types.go b/backend/explore/types.go index b0a1252..fa44676 100644 --- a/backend/explore/types.go +++ b/backend/explore/types.go @@ -25,6 +25,7 @@ type MBArtist struct { Country string `json:"country"` Disambiguation string `json:"disambiguation"` Score int `json:"score"` + OriginalScore int `json:"-"` // MB search relevance, preserved across reranking } // MBReleaseGroup is a Wails-friendly projection of a MusicBrainz