diff --git a/CHANGELOG.md b/CHANGELOG.md index 27a120dd8..690cfac84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix some stream failures caused by loudnorm filter - Fix multi-collection editor improperly disabling collections/smart collections that haven't already been added to the multi-collection - Fix path replacement logic when media server paths use inconsistent casing (e.g. `\\SERVERNAME` AND `\\ServerName`) +- Fix *many* search queries, including actors with the name `Will` ### Changed - Log search index updates under scanner category at debug level, to indicate a potential cause for the UI being out of date diff --git a/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs b/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs index 02125a65e..ec6a5b182 100644 --- a/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs @@ -162,7 +162,7 @@ public class ElasticSearchIndex : ISearchIndex var items = new List(); var totalCount = 0; - Query parsedQuery = LuceneSearchIndex.ParseQuery(query, false); + Query parsedQuery = LuceneSearchIndex.ParseQuery(query); SearchResponse response = await _client.SearchAsync( s => s.Index(IndexName) diff --git a/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs b/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs index 6e2984adf..2ed2cb84b 100644 --- a/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs @@ -1372,22 +1372,24 @@ public sealed class LuceneSearchIndex : ISearchIndex doc.Get(TypeField, CultureInfo.InvariantCulture), Convert.ToInt32(doc.Get(IdField, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture)); - internal static Query ParseQuery(string query, bool useCustomAnalyzers = true) + internal static Query ParseQuery(string query) { - using var analyzer = new StandardAnalyzer(AppLuceneVersion); - var customAnalyzers = new Dictionary(); - - if (useCustomAnalyzers) + using var analyzer = new SimpleAnalyzer(AppLuceneVersion); + var customAnalyzers = new Dictionary { - customAnalyzers.Add(ShowContentRatingField, new KeywordAnalyzer()); - customAnalyzers.Add(ContentRatingField, new KeywordAnalyzer()); - customAnalyzers.Add(StateField, new KeywordAnalyzer()); - } - + { ShowContentRatingField, new KeywordAnalyzer() }, + { ContentRatingField, new KeywordAnalyzer() }, + { StateField, new KeywordAnalyzer() }, + { PlotField, new StandardAnalyzer(AppLuceneVersion) } + }; using var analyzerWrapper = new PerFieldAnalyzerWrapper(analyzer, customAnalyzers); QueryParser parser = new CustomMultiFieldQueryParser(AppLuceneVersion, [TitleField], analyzerWrapper); parser.AllowLeadingWildcard = true; - return ParseQuery(query, parser); + Query result = ParseQuery(query, parser); + + Serilog.Log.Logger.Debug("Search query parsed from [{Query}] to [{ParsedQuery}]", query, result.ToString()); + + return result; } private static Query ParseQuery(string searchQuery, QueryParser parser)