mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
Added localizedName for search function
This commit is contained in:
parent
af35d8aad5
commit
24118da49c
@ -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.
|
||||
|
@ -1,7 +0,0 @@
|
||||
namespace API.DTOs
|
||||
{
|
||||
public class SearchQueryDto
|
||||
{
|
||||
public string QueryString { get; init; }
|
||||
}
|
||||
}
|
@ -80,20 +80,16 @@ namespace API.Data
|
||||
|
||||
public 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.Data
|
||||
await AddVolumeModifiers(userId, volumes);
|
||||
|
||||
return volumes;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user