瀏覽代碼

Fixed NameStartsOrGreater filter

JPVenson 6 月之前
父節點
當前提交
46905ac66a
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      Jellyfin.Server.Implementations/Item/BaseItemRepository.cs

+ 3 - 3
Jellyfin.Server.Implementations/Item/BaseItemRepository.cs

@@ -684,19 +684,19 @@ public sealed class BaseItemRepository(
 
 
         if (!string.IsNullOrWhiteSpace(filter.NameStartsWith))
         if (!string.IsNullOrWhiteSpace(filter.NameStartsWith))
         {
         {
-            baseQuery = baseQuery.Where(e => e.SortName!.Contains(filter.NameStartsWith));
+            baseQuery = baseQuery.Where(e => e.SortName!.StartsWith(filter.NameStartsWith) || e.Name!.StartsWith(filter.NameStartsWith));
         }
         }
 
 
         if (!string.IsNullOrWhiteSpace(filter.NameStartsWithOrGreater))
         if (!string.IsNullOrWhiteSpace(filter.NameStartsWithOrGreater))
         {
         {
             // i hate this
             // i hate this
-            baseQuery = baseQuery.Where(e => e.SortName![0] > filter.NameStartsWithOrGreater[0]);
+            baseQuery = baseQuery.Where(e => e.SortName!.FirstOrDefault() > filter.NameStartsWithOrGreater[0] || e.Name!.FirstOrDefault() > filter.NameStartsWithOrGreater[0]);
         }
         }
 
 
         if (!string.IsNullOrWhiteSpace(filter.NameLessThan))
         if (!string.IsNullOrWhiteSpace(filter.NameLessThan))
         {
         {
             // i hate this
             // i hate this
-            baseQuery = baseQuery.Where(e => e.SortName![0] < filter.NameLessThan[0]);
+            baseQuery = baseQuery.Where(e => e.SortName!.FirstOrDefault() < filter.NameLessThan[0] || e.Name!.FirstOrDefault() < filter.NameLessThan[0]);
         }
         }
 
 
         if (filter.ImageTypes.Length > 0)
         if (filter.ImageTypes.Length > 0)