From f04c18c810d82b471ec26a43ef46961d4d70e555 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Sun, 21 Mar 2021 01:49:10 +0000 Subject: [PATCH] index release date for searching (#93) --- ErsatzTV.Infrastructure/Search/SearchIndex.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ErsatzTV.Infrastructure/Search/SearchIndex.cs b/ErsatzTV.Infrastructure/Search/SearchIndex.cs index 336106a9a..0dbc4eb6b 100644 --- a/ErsatzTV.Infrastructure/Search/SearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/SearchIndex.cs @@ -37,6 +37,7 @@ namespace ErsatzTV.Infrastructure.Search private const string LibraryNameField = "library_name"; private const string TitleAndYearField = "title_and_year"; private const string JumpLetterField = "jump_letter"; + private const string ReleaseDateField = "release_date"; private const string MovieType = "movie"; private const string ShowType = "show"; @@ -58,7 +59,7 @@ namespace ErsatzTV.Infrastructure.Search _logger = logger; } - public int Version => 1; + public int Version => 2; public Task Initialize() { @@ -238,6 +239,15 @@ namespace ErsatzTV.Infrastructure.Search new StringField(JumpLetterField, GetJumpLetter(metadata), Field.Store.YES) }; + if (metadata.ReleaseDate.HasValue) + { + doc.Add( + new StringField( + ReleaseDateField, + metadata.ReleaseDate.Value.ToString("yyyyMMdd"), + Field.Store.NO)); + } + if (!string.IsNullOrWhiteSpace(metadata.Plot)) { doc.Add(new TextField(PlotField, metadata.Plot ?? string.Empty, Field.Store.NO)); @@ -282,6 +292,15 @@ namespace ErsatzTV.Infrastructure.Search new StringField(JumpLetterField, GetJumpLetter(metadata), Field.Store.YES) }; + if (metadata.ReleaseDate.HasValue) + { + doc.Add( + new StringField( + ReleaseDateField, + metadata.ReleaseDate.Value.ToString("yyyyMMdd"), + Field.Store.NO)); + } + if (!string.IsNullOrWhiteSpace(metadata.Plot)) { doc.Add(new TextField(PlotField, metadata.Plot ?? string.Empty, Field.Store.NO));