mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing the search
This commit is contained in:
parent
2f53f2bc67
commit
0bdc69cb86
@ -2,6 +2,7 @@
|
|||||||
using Kyoo.Models.Watch;
|
using Kyoo.Models.Watch;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Kyoo.Controllers
|
namespace Kyoo.Controllers
|
||||||
{
|
{
|
||||||
@ -70,7 +71,7 @@ namespace Kyoo.Controllers
|
|||||||
return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty()
|
return (from show in _database.Shows from l in _database.CollectionLinks.DefaultIfEmpty()
|
||||||
where l.CollectionID == null select show).AsEnumerable().Union(
|
where l.CollectionID == null select show).AsEnumerable().Union(
|
||||||
from collection in _database.Collections select collection.AsShow())
|
from collection in _database.Collections select collection.AsShow())
|
||||||
.Where(x => x.Title.Contains(searchQuery))
|
.Where(x => EF.Functions.Like(x.Title, $"%{searchQuery}%"))
|
||||||
.Take(20).OrderBy(x => x.Title);
|
.Take(20).OrderBy(x => x.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,25 +229,25 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
public IEnumerable<Episode> SearchEpisodes(string searchQuery)
|
public IEnumerable<Episode> SearchEpisodes(string searchQuery)
|
||||||
{
|
{
|
||||||
return (from episode in _database.Episodes where episode.Title.Contains(searchQuery) select episode)
|
return (from episode in _database.Episodes where EF.Functions.Like(episode.Title, $"%{searchQuery}%") select episode)
|
||||||
.Take(20);
|
.Take(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<People> SearchPeople(string searchQuery)
|
public IEnumerable<People> SearchPeople(string searchQuery)
|
||||||
{
|
{
|
||||||
return (from people in _database.Peoples where people.Name.Contains(searchQuery) select people)
|
return (from people in _database.Peoples where EF.Functions.Like(people.Name, $"%{searchQuery}%") select people)
|
||||||
.Take(20);
|
.Take(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Genre> SearchGenres(string searchQuery)
|
public IEnumerable<Genre> SearchGenres(string searchQuery)
|
||||||
{
|
{
|
||||||
return (from genre in _database.Genres where genre.Name.Contains(searchQuery) select genre)
|
return (from genre in _database.Genres where EF.Functions.Like(genre.Name, $"%{searchQuery}%") select genre)
|
||||||
.Take(20);
|
.Take(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Studio> SearchStudios(string searchQuery)
|
public IEnumerable<Studio> SearchStudios(string searchQuery)
|
||||||
{
|
{
|
||||||
return (from studio in _database.Studios where studio.Name.Contains(searchQuery) select studio)
|
return (from studio in _database.Studios where EF.Functions.Like(studio.Name, $"%{searchQuery}%") select studio)
|
||||||
.Take(20);
|
.Take(20);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -53,13 +53,6 @@ namespace Kyoo
|
|||||||
.Property(t => t.IsForced)
|
.Property(t => t.IsForced)
|
||||||
.ValueGeneratedNever();
|
.ValueGeneratedNever();
|
||||||
|
|
||||||
modelBuilder.Entity<Show>().Property(x => x.Title).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
modelBuilder.Entity<Collection>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
modelBuilder.Entity<Episode>().Property(x => x.Title).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
modelBuilder.Entity<People>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
modelBuilder.Entity<Genre>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
modelBuilder.Entity<Studio>().Property(x => x.Name).HasColumnType("TEXT COLLATE NOCASE");
|
|
||||||
|
|
||||||
modelBuilder.Entity<GenreLink>()
|
modelBuilder.Entity<GenreLink>()
|
||||||
.HasKey(x => new {x.ShowID, x.GenreID});
|
.HasKey(x => new {x.ShowID, x.GenreID});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user