mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-05 22:54:12 -04:00
SearchAPI: Always loding shows for the episode search
This commit is contained in:
parent
080d8bef0c
commit
c904f0bf28
@ -121,6 +121,7 @@ namespace Kyoo.Core.Controllers
|
|||||||
public override async Task<ICollection<Episode>> Search(string query)
|
public override async Task<ICollection<Episode>> Search(string query)
|
||||||
{
|
{
|
||||||
return await _database.Episodes
|
return await _database.Episodes
|
||||||
|
.Include(x => x.Show)
|
||||||
.Where(x => x.EpisodeNumber != null || x.AbsoluteNumber != null)
|
.Where(x => x.EpisodeNumber != null || x.AbsoluteNumber != null)
|
||||||
.Where(_database.Like<Episode>(x => x.Title, $"%{query}%"))
|
.Where(_database.Like<Episode>(x => x.Title, $"%{query}%"))
|
||||||
.OrderBy(DefaultSort)
|
.OrderBy(DefaultSort)
|
||||||
|
@ -52,12 +52,7 @@ namespace Kyoo.Core.Api
|
|||||||
List<string> fields = context.HttpContext.Request.Query["fields"]
|
List<string> fields = context.HttpContext.Request.Query["fields"]
|
||||||
.SelectMany(x => x.Split(','))
|
.SelectMany(x => x.Split(','))
|
||||||
.ToList();
|
.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)
|
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
|
||||||
{
|
{
|
||||||
Type type = descriptor.MethodInfo.ReturnType;
|
Type type = descriptor.MethodInfo.ReturnType;
|
||||||
|
@ -70,6 +70,8 @@ namespace Kyoo.Core.Api
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public async Task<ActionResult<SearchResult>> Search(string query)
|
public async Task<ActionResult<SearchResult>> Search(string query)
|
||||||
{
|
{
|
||||||
|
HttpContext.Items["ResourceType"] = nameof(Episode);
|
||||||
|
HttpContext.Items["fields"] = new[] { nameof(Episode.Show) };
|
||||||
return new SearchResult
|
return new SearchResult
|
||||||
{
|
{
|
||||||
Query = query,
|
Query = query,
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 77cf3e89a5f36c568f9bed3e1d6e0603e548e170
|
Subproject commit 5df3d529c96a544ebf2dd8166a7ef2a23e6228a8
|
Loading…
x
Reference in New Issue
Block a user