mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 18:24:14 -04:00
Solving a bug with the search query
This commit is contained in:
parent
5eed35d4ac
commit
cfe78d820c
@ -67,10 +67,9 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
public IEnumerable<Show> GetShows(string searchQuery)
|
public IEnumerable<Show> GetShows(string searchQuery)
|
||||||
{
|
{
|
||||||
return (from show in _database.Shows join link in _database.CollectionLinks on show equals link.Show into gj
|
return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty()
|
||||||
from l in gj.DefaultIfEmpty()
|
where l.CollectionID == null select show).AsEnumerable().Union(
|
||||||
where l.CollectionID == null select l.Show).Union(
|
from collection in _database.Collections select collection.AsShow())
|
||||||
from collection in _database.Collections select collection.AsShow())
|
|
||||||
.Where(x => x.Title.Contains(searchQuery)).OrderBy(x => x.Title);
|
.Where(x => x.Title.Contains(searchQuery)).OrderBy(x => x.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@ namespace Kyoo.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class SearchController : ControllerBase
|
public class SearchController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public SearchController(ILibraryManager libraryManager)
|
public SearchController(ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
this.libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{query}")]
|
[HttpGet("{query}")]
|
||||||
@ -21,11 +21,11 @@ namespace Kyoo.Controllers
|
|||||||
SearchResult result = new SearchResult
|
SearchResult result = new SearchResult
|
||||||
{
|
{
|
||||||
Query = query,
|
Query = query,
|
||||||
Shows = libraryManager.GetShows(query),
|
Shows = _libraryManager.GetShows(query),
|
||||||
Episodes = libraryManager.SearchEpisodes(query),
|
Episodes = _libraryManager.SearchEpisodes(query),
|
||||||
People = libraryManager.SearchPeople(query),
|
People = _libraryManager.SearchPeople(query),
|
||||||
Genres = libraryManager.SearchGenres(query),
|
Genres = _libraryManager.SearchGenres(query),
|
||||||
Studios = libraryManager.SearchStudios(query)
|
Studios = _libraryManager.SearchStudios(query)
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user