diff options
| author | theguymadmax <theguymadmax@proton.me> | 2025-10-08 11:23:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-08 09:23:20 -0600 |
| commit | 07d31c6ba51bdbacb0be4ff5631e4567d7ea6980 (patch) | |
| tree | ffde9f6fa85bba5ef1adaf040c9f3379f90f1c12 /Jellyfin.Server.Implementations/Item | |
| parent | 79ff0b0b002c27142769de4a37fcb555b1474888 (diff) | |
Improve performance on people query (#14963)
Diffstat (limited to 'Jellyfin.Server.Implementations/Item')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/BaseItemRepository.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index 0884efa43..ef444b930 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -1875,10 +1875,17 @@ public sealed class BaseItemRepository if (filter.PersonIds.Length > 0) { + var peopleEntityIds = context.BaseItems + .WhereOneOrMany(filter.PersonIds, b => b.Id) + .Join( + context.Peoples, + b => b.Name, + p => p.Name, + (b, p) => p.Id); + baseQuery = baseQuery - .Where(e => - context.PeopleBaseItemMap.Where(w => context.BaseItems.Where(r => filter.PersonIds.Contains(r.Id)).Any(f => f.Name == w.People.Name)) - .Any(f => f.ItemId == e.Id)); + .Where(e => context.PeopleBaseItemMap + .Any(m => m.ItemId == e.Id && peopleEntityIds.Contains(m.PeopleId))); } if (!string.IsNullOrWhiteSpace(filter.Person)) |
