add show_studio search field (#1584)
This commit is contained in:
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased]
|
||||
- Add `show_studio` to search index for seasons and episodes
|
||||
|
||||
## [0.8.5-beta] - 2024-01-30
|
||||
### Added
|
||||
|
||||
@@ -61,6 +61,10 @@ public class SearchRepository : ISearchRepository
|
||||
.ThenInclude(s => s.Show)
|
||||
.ThenInclude(s => s.ShowMetadata)
|
||||
.ThenInclude(s => s.Tags)
|
||||
.Include(mi => (mi as Episode).Season)
|
||||
.ThenInclude(s => s.Show)
|
||||
.ThenInclude(s => s.ShowMetadata)
|
||||
.ThenInclude(s => s.Studios)
|
||||
.Include(mi => (mi as Season).SeasonMetadata)
|
||||
.ThenInclude(sm => sm.Genres)
|
||||
.Include(mi => (mi as Season).SeasonMetadata)
|
||||
@@ -77,6 +81,9 @@ public class SearchRepository : ISearchRepository
|
||||
.Include(mi => (mi as Season).Show)
|
||||
.ThenInclude(sm => sm.ShowMetadata)
|
||||
.ThenInclude(sm => sm.Tags)
|
||||
.Include(mi => (mi as Season).Show)
|
||||
.ThenInclude(sm => sm.ShowMetadata)
|
||||
.ThenInclude(sm => sm.Studios)
|
||||
.Include(mi => (mi as Show).ShowMetadata)
|
||||
.ThenInclude(mm => mm.Genres)
|
||||
.Include(mi => (mi as Show).ShowMetadata)
|
||||
@@ -231,6 +238,10 @@ public class SearchRepository : ISearchRepository
|
||||
.ThenInclude(s => s.Show)
|
||||
.ThenInclude(s => s.ShowMetadata)
|
||||
.ThenInclude(s => s.Tags)
|
||||
.Include(mi => (mi as Episode).Season)
|
||||
.ThenInclude(s => s.Show)
|
||||
.ThenInclude(s => s.ShowMetadata)
|
||||
.ThenInclude(s => s.Studios)
|
||||
.Include(mi => (mi as Season).SeasonMetadata)
|
||||
.ThenInclude(sm => sm.Genres)
|
||||
.Include(mi => (mi as Season).SeasonMetadata)
|
||||
@@ -247,6 +258,9 @@ public class SearchRepository : ISearchRepository
|
||||
.Include(mi => (mi as Season).Show)
|
||||
.ThenInclude(sm => sm.ShowMetadata)
|
||||
.ThenInclude(sm => sm.Tags)
|
||||
.Include(mi => (mi as Season).Show)
|
||||
.ThenInclude(sm => sm.ShowMetadata)
|
||||
.ThenInclude(sm => sm.Studios)
|
||||
.Include(mi => (mi as Show).ShowMetadata)
|
||||
.ThenInclude(mm => mm.Genres)
|
||||
.Include(mi => (mi as Show).ShowMetadata)
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ElasticSearchIndex : ISearchIndex
|
||||
return exists.IsValidResponse;
|
||||
}
|
||||
|
||||
public int Version => 37;
|
||||
public int Version => 38;
|
||||
|
||||
public async Task<bool> Initialize(
|
||||
ILocalFileSystem localFileSystem,
|
||||
@@ -231,6 +231,7 @@ public class ElasticSearchIndex : ISearchIndex
|
||||
.Text(t => t.ShowTitle, t => t.Store(false))
|
||||
.Text(t => t.ShowGenre, t => t.Store(false))
|
||||
.Text(t => t.ShowTag, t => t.Store(false))
|
||||
.Text(t => t.ShowStudio, t => t.Store(false))
|
||||
.Text(t => t.Style, t => t.Store(false))
|
||||
.Text(t => t.Mood, t => t.Store(false))
|
||||
.Text(t => t.Album, t => t.Store(false))
|
||||
@@ -399,6 +400,7 @@ public class ElasticSearchIndex : ISearchIndex
|
||||
ShowTitle = showMetadata.Title,
|
||||
ShowGenre = showMetadata.Genres.Map(g => g.Name).ToList(),
|
||||
ShowTag = showMetadata.Tags.Map(t => t.Name).ToList(),
|
||||
ShowStudio = showMetadata.Studios.Map(s => s.Name).ToList(),
|
||||
Language = await GetLanguages(
|
||||
searchRepository,
|
||||
await searchRepository.GetLanguagesForSeason(season)),
|
||||
@@ -587,6 +589,7 @@ public class ElasticSearchIndex : ISearchIndex
|
||||
doc.ShowTitle = showMetadata.Title;
|
||||
doc.ShowGenre = showMetadata.Genres.Map(g => g.Name).ToList();
|
||||
doc.ShowTag = showMetadata.Tags.Map(t => t.Name).ToList();
|
||||
doc.ShowStudio = showMetadata.Studios.Map(s => s.Name).ToList();
|
||||
}
|
||||
|
||||
AddStatistics(doc, episode.MediaVersions);
|
||||
|
||||
@@ -60,6 +60,7 @@ public sealed class LuceneSearchIndex : ISearchIndex
|
||||
internal const string ShowTitleField = "show_title";
|
||||
internal const string ShowGenreField = "show_genre";
|
||||
internal const string ShowTagField = "show_tag";
|
||||
internal const string ShowStudioField = "show_studio";
|
||||
internal const string MetadataKindField = "metadata_kind";
|
||||
internal const string VideoCodecField = "video_codec";
|
||||
internal const string VideoDynamicRange = "video_dynamic_range";
|
||||
@@ -108,7 +109,7 @@ public sealed class LuceneSearchIndex : ISearchIndex
|
||||
return Task.FromResult(directoryExists && fileExists);
|
||||
}
|
||||
|
||||
public int Version => 37;
|
||||
public int Version => 38;
|
||||
|
||||
public async Task<bool> Initialize(
|
||||
ILocalFileSystem localFileSystem,
|
||||
@@ -681,6 +682,11 @@ public sealed class LuceneSearchIndex : ISearchIndex
|
||||
doc.Add(new TextField(ShowTagField, tag.Name, Field.Store.NO));
|
||||
}
|
||||
|
||||
foreach (Studio studio in showMetadata.Studios)
|
||||
{
|
||||
doc.Add(new TextField(ShowStudioField, studio.Name, Field.Store.NO));
|
||||
}
|
||||
|
||||
List<string> languages = await searchRepository.GetLanguagesForSeason(season);
|
||||
await AddLanguages(searchRepository, doc, languages);
|
||||
|
||||
@@ -951,6 +957,11 @@ public sealed class LuceneSearchIndex : ISearchIndex
|
||||
{
|
||||
doc.Add(new TextField(ShowTagField, tag.Name, Field.Store.NO));
|
||||
}
|
||||
|
||||
foreach (Studio studio in showMetadata.Studios)
|
||||
{
|
||||
doc.Add(new TextField(ShowStudioField, studio.Name, Field.Store.NO));
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(metadata.Title))
|
||||
|
||||
@@ -109,6 +109,9 @@ public class ElasticSearchItem : MinimalElasticSearchItem
|
||||
[JsonPropertyName(LuceneSearchIndex.ShowTagField)]
|
||||
public List<string> ShowTag { get; set; }
|
||||
|
||||
[JsonPropertyName(LuceneSearchIndex.ShowStudioField)]
|
||||
public List<string> ShowStudio { get; set; }
|
||||
|
||||
[JsonPropertyName(LuceneSearchIndex.StyleField)]
|
||||
public List<string> Style { get; set; }
|
||||
|
||||
|
||||
+1
-2
@@ -96,8 +96,7 @@ public class Program
|
||||
{
|
||||
loggerConfiguration = loggerConfiguration.WriteTo.Console(
|
||||
theme: AnsiConsoleTheme.Code,
|
||||
formatProvider: CultureInfo.InvariantCulture,
|
||||
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <{SourceContext:l}> {NewLine}{Exception}");
|
||||
formatProvider: CultureInfo.InvariantCulture);
|
||||
|
||||
// for troubleshooting log category
|
||||
// outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <{SourceContext:l}> {NewLine}{Exception}"
|
||||
|
||||
Reference in New Issue
Block a user