mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-18 15:03:06 +03:00
Backport pull request #15381 from jellyfin/release-10.11.z
Fix name filters to use only SortName
Original-merge: 7222910b05
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
@@ -1944,19 +1944,20 @@ public sealed class BaseItemRepository
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(filter.NameStartsWith))
|
if (!string.IsNullOrWhiteSpace(filter.NameStartsWith))
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery.Where(e => e.SortName!.StartsWith(filter.NameStartsWith));
|
var startsWithLower = filter.NameStartsWith.ToLowerInvariant();
|
||||||
|
baseQuery = baseQuery.Where(e => e.SortName!.StartsWith(startsWithLower));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(filter.NameStartsWithOrGreater))
|
if (!string.IsNullOrWhiteSpace(filter.NameStartsWithOrGreater))
|
||||||
{
|
{
|
||||||
// i hate this
|
var startsOrGreaterLower = filter.NameStartsWithOrGreater.ToLowerInvariant();
|
||||||
baseQuery = baseQuery.Where(e => e.SortName!.FirstOrDefault() > filter.NameStartsWithOrGreater[0] || e.Name!.FirstOrDefault() > filter.NameStartsWithOrGreater[0]);
|
baseQuery = baseQuery.Where(e => e.SortName!.CompareTo(startsOrGreaterLower) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(filter.NameLessThan))
|
if (!string.IsNullOrWhiteSpace(filter.NameLessThan))
|
||||||
{
|
{
|
||||||
// i hate this
|
var lessThanLower = filter.NameLessThan.ToLowerInvariant();
|
||||||
baseQuery = baseQuery.Where(e => e.SortName!.FirstOrDefault() < filter.NameLessThan[0] || e.Name!.FirstOrDefault() < filter.NameLessThan[0]);
|
baseQuery = baseQuery.Where(e => e.SortName!.CompareTo(lessThanLower ) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.ImageTypes.Length > 0)
|
if (filter.ImageTypes.Length > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user