Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Added localizedName for search function
Joseph Milazzo24118da49c57
diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.csindex e3f17ec3e..2a0192955 100644--- a/API/Controllers/LibraryController.cs+++ b/API/Controllers/LibraryController.cs@@ -228,6 +228,7 @@ namespace API.Controllers[HttpGet("search")]public async Task<ActionResult<IEnumerable<SearchResultDto>>> Search(string queryString){+ // TODO: Add indecies to DB for the searched fields//NOTE: What about normalizing search query and only searching against normalizedname in Series?// So One Punch would match One-Punch// This also means less indexes we need.diff --git a/API/DTOs/SearchQueryDto.cs b/API/DTOs/SearchQueryDto.csdeleted file mode 100644index b637f952b..000000000--- a/API/DTOs/SearchQueryDto.cs+++ /dev/null@@ -1,7 +0,0 @@-namespace API.DTOs-{- public class SearchQueryDto- {- public string QueryString { get; init; }- }-}\ No newline at end of filediff --git a/API/Data/SeriesRepository.cs b/API/Data/SeriesRepository.csindex 4975c2654..f8b128598 100644--- a/API/Data/SeriesRepository.cs+++ b/API/Data/SeriesRepository.cs@@ -80,20 +80,16 @@ namespace API.Datapublic async Task<IEnumerable<SearchResultDto>> SearchSeries(int[] libraryIds, string searchQuery){- var sw = Stopwatch.StartNew();- var series = await _context.Series+ return await _context.Series.Where(s => libraryIds.Contains(s.LibraryId)).Where(s => EF.Functions.Like(s.Name, $"%{searchQuery}%")- || EF.Functions.Like(s.OriginalName, $"%{searchQuery}%"))+ || EF.Functions.Like(s.OriginalName, $"%{searchQuery}%")+ || EF.Functions.Like(s.LocalizedName, $"%{searchQuery}%")).Include(s => s.Library) // NOTE: Is there a way to do this faster?.OrderBy(s => s.SortName).AsNoTracking().ProjectTo<SearchResultDto>(_mapper.ConfigurationProvider).ToListAsync();--- _logger.LogDebug("Processed SearchSeries in {ElapsedMilliseconds} milliseconds", sw.ElapsedMilliseconds);- return series;}public async Task<IEnumerable<VolumeDto>> GetVolumesDtoAsync(int seriesId, int userId)@@ -109,7 +105,6 @@ namespace API.Dataawait AddVolumeModifiers(userId, volumes);return volumes;-}