From b3a1e71570283a787d5cf8875a66907694d499a9 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Sat, 20 Mar 2021 15:32:30 -0500 Subject: [PATCH] only search title by default, allow leading wildcards --- ErsatzTV.Infrastructure/Search/SearchIndex.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ErsatzTV.Infrastructure/Search/SearchIndex.cs b/ErsatzTV.Infrastructure/Search/SearchIndex.cs index 4894ea05f..e82512a07 100644 --- a/ErsatzTV.Infrastructure/Search/SearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/SearchIndex.cs @@ -44,7 +44,6 @@ namespace ErsatzTV.Infrastructure.Search private readonly ILocalFileSystem _localFileSystem; - private readonly string[] _searchFields = { TitleField, GenreField, TagField }; private readonly ISearchRepository _searchRepository; public SearchIndex(ILocalFileSystem localFileSystem, ISearchRepository searchRepository) @@ -150,7 +149,8 @@ namespace ErsatzTV.Infrastructure.Search using var analyzer = new StandardAnalyzer(AppLuceneVersion); QueryParser parser = !string.IsNullOrWhiteSpace(searchField) ? new QueryParser(AppLuceneVersion, searchField, analyzer) - : new MultiFieldQueryParser(AppLuceneVersion, _searchFields, analyzer); + : new MultiFieldQueryParser(AppLuceneVersion, new[] { TitleField }, analyzer); + parser.AllowLeadingWildcard = true; Query query = ParseQuery(searchQuery, parser); var filter = new DuplicateFilter(TitleAndYearField); var sort = new Sort(new SortField(SortTitleField, SortFieldType.STRING));