=== Slim/Control/Queries.pm ================================================================== --- Slim/Control/Queries.pm (revision 32446) +++ Slim/Control/Queries.pm (local) @@ -537,6 +537,8 @@ $where->{'genreTracks.genre'} = $genreID; push @{$attr->{'join'}}, {'contributorTracks' => {'track' => 'genreTracks'}}; + $where->{'contributorTracks.role'} = { 'in' => Slim::Schema->artistOnlyRoles }; + $where_va->{'genreTracks.genre'} = $genreID; push @{$attr_va->{'join'}}, {'tracks' => 'genreTracks'}; } @@ -591,7 +593,7 @@ } # use browse here - $rs = Slim::Schema->rs('Contributor')->browse->search($where, $attr); + $rs = Slim::Schema->rs('Contributor')->browse( undef, $where )->search( {}, $attr ); } my $count = $rs->count; === Slim/Schema/ResultSet/Contributor.pm ================================================================== --- Slim/Schema/ResultSet/Contributor.pm (revision 32446) +++ Slim/Schema/ResultSet/Contributor.pm (local) @@ -69,7 +69,7 @@ sub browse { my $self = shift; my $find = shift; - my $cond = shift; + my $cond = shift || {}; my $sort = shift; my @joins = (); @@ -77,8 +77,10 @@ # The user may not want to include all the composers / conductors if ($roles) { - - $cond->{'contributorAlbums.role'} = { 'in' => $roles }; + # Bug 7992, Don't join on contributorAlbums if this is for a genre query + if ( !exists $cond->{'genreTracks.genre'} ) { + $cond->{'contributorAlbums.role'} = { 'in' => $roles }; + } } if (preferences('server')->get('variousArtistAutoIdentification')) { @@ -89,7 +91,9 @@ } elsif ($roles) { - push @joins, 'contributorAlbums'; + if ( !exists $cond->{'genreTracks.genre'} ) { + push @joins, 'contributorAlbums'; + } } return $self->search($cond, {