SearchAPI: Always loding shows for the episode search

This commit is contained in:
Zoe Roux 2021-11-11 21:36:52 +01:00
parent 080d8bef0c
commit c904f0bf28
No known key found for this signature in database
GPG Key ID: 8BB9CF5EF72AE933
4 changed files with 5 additions and 7 deletions

View File

@ -121,6 +121,7 @@ namespace Kyoo.Core.Controllers
public override async Task<ICollection<Episode>> Search(string query)
{
return await _database.Episodes
.Include(x => x.Show)
.Where(x => x.EpisodeNumber != null || x.AbsoluteNumber != null)
.Where(_database.Like<Episode>(x => x.Title, $"%{query}%"))
.OrderBy(DefaultSort)

View File

@ -52,12 +52,7 @@ namespace Kyoo.Core.Api
List<string> fields = context.HttpContext.Request.Query["fields"]
.SelectMany(x => x.Split(','))
.ToList();
if (fields.Contains("internal"))
{
fields.Remove("internal");
context.HttpContext.Items["internal"] = true;
// TODO disable SerializeAs attributes when this is true.
}
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
{
Type type = descriptor.MethodInfo.ReturnType;

View File

@ -70,6 +70,8 @@ namespace Kyoo.Core.Api
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<SearchResult>> Search(string query)
{
HttpContext.Items["ResourceType"] = nameof(Episode);
HttpContext.Items["fields"] = new[] { nameof(Episode.Show) };
return new SearchResult
{
Query = query,

@ -1 +1 @@
Subproject commit 77cf3e89a5f36c568f9bed3e1d6e0603e548e170
Subproject commit 5df3d529c96a544ebf2dd8166a7ef2a23e6228a8