Browse Source

fix indexing songs with null artists/album artists (#2592)

pull/2593/head
Jason Dove 9 months ago committed by GitHub
parent
commit
c6245bae0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      ErsatzTV.Application/MediaCards/Mapper.cs
  3. 3
      ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs
  4. 7
      ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs

1
CHANGELOG.md

@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix building sequential schedules across a UTC offset change
- Fix block start time calculation across a UTC offset change
- Fix XMLTV generation for channels using on-demand playout mode
- Fix some removed songs from appearing in the trash
### Changed
- Use smaller batch size for search index updates (100, down from 1000)

2
ErsatzTV.Application/MediaCards/Mapper.cs

@ -140,7 +140,7 @@ internal static class Mapper @@ -140,7 +140,7 @@ internal static class Mapper
return new SongCardViewModel(
songMetadata.SongId,
songMetadata.Title,
string.Join(", ", songMetadata.Artists) + album,
string.Join(", ", songMetadata.Artists ?? []) + album,
songMetadata.SortTitle,
GetThumbnail(songMetadata, None, None),
songMetadata.Song.State);

3
ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs

@ -730,6 +730,9 @@ public class ElasticSearchIndex : ISearchIndex @@ -730,6 +730,9 @@ public class ElasticSearchIndex : ISearchIndex
{
try
{
metadata.AlbumArtists ??= [];
metadata.Artists ??= [];
var doc = new ElasticSearchItem
{
Id = song.Id,

7
ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs

@ -1287,12 +1287,13 @@ public sealed class LuceneSearchIndex : ISearchIndex @@ -1287,12 +1287,13 @@ public sealed class LuceneSearchIndex : ISearchIndex
private async Task UpdateSong(ISearchRepository searchRepository, Song song)
{
Option<SongMetadata> maybeMetadata = song.SongMetadata.HeadOrNone();
if (maybeMetadata.IsSome)
foreach (var metadata in maybeMetadata)
{
SongMetadata metadata = maybeMetadata.ValueUnsafe();
try
{
metadata.AlbumArtists ??= [];
metadata.Artists ??= [];
var doc = new Document
{
new StringField(IdField, song.Id.ToString(CultureInfo.InvariantCulture), Field.Store.YES),

Loading…
Cancel
Save