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)
|
||||
{
|
||||
return (from show in _database.Shows join link in _database.CollectionLinks on show equals link.Show into gj
|
||||
from l in gj.DefaultIfEmpty()
|
||||
where l.CollectionID == null select l.Show).Union(
|
||||
from collection in _database.Collections select collection.AsShow())
|
||||
return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty()
|
||||
where l.CollectionID == null select show).AsEnumerable().Union(
|
||||
from collection in _database.Collections select collection.AsShow())
|
||||
.Where(x => x.Title.Contains(searchQuery)).OrderBy(x => x.Title);
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,11 @@ namespace Kyoo.Controllers
|
||||
[ApiController]
|
||||
public class SearchController : ControllerBase
|
||||
{
|
||||
private readonly ILibraryManager libraryManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public SearchController(ILibraryManager libraryManager)
|
||||
{
|
||||
this.libraryManager = libraryManager;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
[HttpGet("{query}")]
|
||||
@ -21,11 +21,11 @@ namespace Kyoo.Controllers
|
||||
SearchResult result = new SearchResult
|
||||
{
|
||||
Query = query,
|
||||
Shows = libraryManager.GetShows(query),
|
||||
Episodes = libraryManager.SearchEpisodes(query),
|
||||
People = libraryManager.SearchPeople(query),
|
||||
Genres = libraryManager.SearchGenres(query),
|
||||
Studios = libraryManager.SearchStudios(query)
|
||||
Shows = _libraryManager.GetShows(query),
|
||||
Episodes = _libraryManager.SearchEpisodes(query),
|
||||
People = _libraryManager.SearchPeople(query),
|
||||
Genres = _libraryManager.SearchGenres(query),
|
||||
Studios = _libraryManager.SearchStudios(query)
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user