Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-13561

Show alias next to entity name in tag pages

          [MBS-13561] Show alias next to entity name in tag pages

          Good point! Extended your MBS-13872 to be for both tags and ratings since they're related pages, thanks!

          Nicolás Tamargo added a comment - Good point! Extended your MBS-13872 to be for both tags and ratings since they're related pages, thanks!

          chaban added a comment -

          This works on the normal tag pages now but not on user tag pages
          /user/chaban/tag/音楽素材/artist is still lacking the primary aliases

          chaban added a comment - This works on the normal tag pages now but not on user tag pages /user/chaban/tag/音楽素材/artist is still lacking the primary aliases

          GitHub Bot added a comment -

          See code changes in pull request #3410 submitted by reosarevok.

          GitHub Bot added a comment - See code changes in pull request #3410 submitted by reosarevok .

          derat added a comment -

          Unassigning since reosarevok mentioned that he might look at this.

          derat added a comment - Unassigning since reosarevok mentioned that he might look at this.

          load_related_info can be heavy for some entity types. IIUC, you only need to call it for artists, and only to load primary aliases, so I'd suggest moving the the alias-loading code to a separate method which can be called both from load_related_info and also directly.

          Michael Wiencek added a comment - load_related_info can be heavy for some entity types. IIUC, you only need to call it for artists, and only to load primary aliases, so I'd suggest moving the the alias-loading code to a separate method which can be called both from load_related_info and also directly.

          derat added a comment - - edited

          Yeah, that seems correct. find_entities in Data::EntityTag currently just joins artist to artist_tag and calls _new_from_row in the builder that it passes to query_to_list_limited, so it doesn't get any aliases.

          I see aliases if I change find_entities to do something like this:

              my ($rows, $hits) = $self->query_to_list_limited($query, [$tag_id], $limit, $offset, sub {
                  my ($model, $row) = @_;
                   
                  my $entity = $model->parent->_new_from_row($row);
                  return MusicBrainz::Server::Entity::AggregatedTag->new(
                      count => $row->{tt_count},
                      entity_id => $entity->id,
                      entity => $entity,      
                  );
              });       
          
              if ($self->parent->can('load_related_info')) {
                  my @entities = map { $_->{entity} } @$rows;
                  $self->parent->load_related_info(\@entities, 'en');
              }
                                      
              ($rows, $hits);
          

          Is that desirable (after passing the correct language through)? I don't have a good feel for how expensive it is to do something like this.

          I'm also not sure if this should only happen for artists (since that's the only entity type whose load_related_info takes a language and loads aliases, as far as I'm aware).

          This also isn't enough to get the alias shown alongside artists in /tag/.../release-group.

          derat added a comment - - edited Yeah, that seems correct. find_entities in Data::EntityTag currently just joins artist to artist_tag and calls _new_from_row in the builder that it passes to query_to_list_limited , so it doesn't get any aliases. I see aliases if I change find_entities to do something like this: my ( $rows , $hits ) = $self ->query_to_list_limited( $query , [$tag_id], $limit , $offset , sub { my ( $model , $row ) = @ _ ; my $entity = $model ->parent->_new_from_row( $row ); return MusicBrainz::Server::Entity::AggregatedTag->new( count => $row ->{tt_count}, entity_id => $entity ->id, entity => $entity , ); }); if ( $self ->parent-> can ('load_related_info')) { my @entities = map { $ _ ->{entity} } @ $rows ; $self ->parent->load_related_info(\ @entities , 'en'); } ( $rows , $hits ); Is that desirable (after passing the correct language through)? I don't have a good feel for how expensive it is to do something like this. I'm also not sure if this should only happen for artists (since that's the only entity type whose load_related_info takes a language and loads aliases, as far as I'm aware). This also isn't enough to get the alias shown alongside artists in /tag/.../release-group .

          My guess is that we load stuff separately for tag pages and we need to load more things But take a look, and come ping me in IRC if you don't find anything so I can help take a look!

          Nicolás Tamargo added a comment - My guess is that we load stuff separately for tag pages and we need to load more things But take a look, and come ping me in IRC if you don't find anything so I can help take a look!

          derat added a comment -

          I haven't looked at this code before, but the TagEntitiesList component uses DescriptiveLink, which uses EntityLink, which has the change to show the primary alias when showDisambiguation is true. That's the default in DescriptiveLink, so I'll try to look into why primary aliases aren't shown here.

          derat added a comment - I haven't looked at this code before, but the TagEntitiesList component uses DescriptiveLink , which uses EntityLink , which has the change to show the primary alias when showDisambiguation is true. That's the default in DescriptiveLink , so I'll try to look into why primary aliases aren't shown here.

            reosarevok Nicolás Tamargo
            chaban chaban
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2025-01-13