mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: SQL error searching for movie by name
This commit is contained in:
parent
32a6c9fe2a
commit
5c9b85972d
@ -169,6 +169,16 @@ public void where_in_list_2()
|
|||||||
_subject.ToString().Should().Be($"((\"Movies\".\"CleanTitle\" = @Clause1_P1) AND (\"Movies\".\"Id\" IN (1, 2, 3)))");
|
_subject.ToString().Should().Be($"((\"Movies\".\"CleanTitle\" = @Clause1_P1) AND (\"Movies\".\"Id\" IN (1, 2, 3)))");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void where_in_string_list()
|
||||||
|
{
|
||||||
|
var list = new List<string> { "first", "second", "third" };
|
||||||
|
|
||||||
|
_subject = Where(x => list.Contains(x.CleanTitle));
|
||||||
|
|
||||||
|
_subject.ToString().Should().Be($"(\"Movies\".\"CleanTitle\" IN @Clause1_P1)");
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void enum_as_int()
|
public void enum_as_int()
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ private void ParseContainsExpression(MethodCallExpression expression)
|
|||||||
{
|
{
|
||||||
var list = expression.Object;
|
var list = expression.Object;
|
||||||
|
|
||||||
if (list != null && (list.Type == typeof(string) || list.Type == typeof(List<string>)))
|
if (list != null && (list.Type == typeof(string)))
|
||||||
{
|
{
|
||||||
ParseStringContains(expression);
|
ParseStringContains(expression);
|
||||||
return;
|
return;
|
||||||
|
@ -101,8 +101,9 @@ public bool MoviePathExists(string path)
|
|||||||
|
|
||||||
public List<Movie> FindByTitles(List<string> titles)
|
public List<Movie> FindByTitles(List<string> titles)
|
||||||
{
|
{
|
||||||
return Query(Builder().OrWhere<Movie>(x => titles.Contains(x.CleanTitle))
|
var distinct = titles.Distinct().ToList();
|
||||||
.OrWhere<AlternativeTitle>(x => titles.Contains(x.CleanTitle)));
|
return Query(Builder().OrWhere<Movie>(x => distinct.Contains(x.CleanTitle))
|
||||||
|
.OrWhere<AlternativeTitle>(x => distinct.Contains(x.CleanTitle)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Movie> FindByTitleInexact(string cleanTitle)
|
public List<Movie> FindByTitleInexact(string cleanTitle)
|
||||||
|
Loading…
Reference in New Issue
Block a user