support more filters at db level
This commit is contained in:
parent
4ddde2cdc2
commit
311dd50eb7
|
@ -839,11 +839,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
|
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (query.SortBy.Contains(ItemSortBy.StartDate, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.StartDate");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (query.SortBy.Contains(ItemSortBy.Studio, StringComparer.OrdinalIgnoreCase))
|
if (query.SortBy.Contains(ItemSortBy.Studio, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.Studio");
|
Logger.Debug("Query requires post-filtering due to ItemSortBy.Studio");
|
||||||
|
@ -1059,30 +1054,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameContains");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameLessThan))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameLessThan");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameStartsWith");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameStartsWithOrGreater))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameStartsWithOrGreater");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.AirDays.Length > 0)
|
if (query.AirDays.Length > 0)
|
||||||
{
|
{
|
||||||
Logger.Debug("Query requires post-filtering due to AirDays");
|
Logger.Debug("Query requires post-filtering due to AirDays");
|
||||||
|
|
|
@ -2071,6 +2071,30 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
}
|
}
|
||||||
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains + "%";
|
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains + "%";
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
|
||||||
|
{
|
||||||
|
if (_config.Configuration.SchemaVersion >= 66)
|
||||||
|
{
|
||||||
|
whereClauses.Add("CleanName like @NameStartsWith");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
whereClauses.Add("Name like @NameStartsWith");
|
||||||
|
}
|
||||||
|
cmd.Parameters.Add(cmd, "@NameStartsWith", DbType.String).Value = query.NameStartsWith + "%";
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(query.NameStartsWithOrGreater))
|
||||||
|
{
|
||||||
|
whereClauses.Add("SortName >= @NameStartsWithOrGreater");
|
||||||
|
// lowercase this because SortName is stored as lowercase
|
||||||
|
cmd.Parameters.Add(cmd, "@NameStartsWithOrGreater", DbType.String).Value = query.NameStartsWithOrGreater.ToLower();
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(query.NameLessThan))
|
||||||
|
{
|
||||||
|
whereClauses.Add("SortName < @NameLessThan");
|
||||||
|
// lowercase this because SortName is stored as lowercase
|
||||||
|
cmd.Parameters.Add(cmd, "@NameLessThan", DbType.String).Value = query.NameLessThan.ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
if (query.Genres.Length > 0)
|
if (query.Genres.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user