< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Library.Search.SearchQueryAccessFilter
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Library/Search/SearchQueryAccessFilter.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 38
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 8/6/2026 - 12:17:15 AM Line coverage: 0% (0/8) Branch coverage: 0% (0/2) Total lines: 38 8/6/2026 - 12:17:15 AM Line coverage: 0% (0/8) Branch coverage: 0% (0/2) Total lines: 38

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Build(...)0%620%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Library/Search/SearchQueryAccessFilter.cs

#LineLine coverage
 1using Jellyfin.Database.Implementations.Entities;
 2using Jellyfin.Extensions;
 3using MediaBrowser.Controller.Entities;
 4using MediaBrowser.Controller.Library;
 5
 6namespace Emby.Server.Implementations.Library.Search;
 7
 8/// <summary>
 9/// Builds the access filter that decides which items a search may return for a user.
 10/// </summary>
 11internal static class SearchQueryAccessFilter
 12{
 13    /// <summary>
 14    /// Builds an access filter carrying the search's library access and type filters.
 15    /// </summary>
 16    /// <param name="user">The user the search runs for.</param>
 17    /// <param name="query">The search query.</param>
 18    /// <param name="libraryManager">The library manager.</param>
 19    /// <returns>The access filter.</returns>
 20    public static InternalItemsQuery Build(User user, SearchProviderQuery query, ILibraryManager libraryManager)
 21    {
 22        // The type filters have to travel with the access filter: a by-name item belongs to no
 23        // library, so it carries no TopParentId to match, and the library filter only knows to
 24        // exempt it when the query says those types are wanted. A search scoped to a parent gets
 25        // no exemption because a by-name item has no parent to descend from either.
 026        var accessFilter = new InternalItemsQuery(user)
 027        {
 028            IncludeItemTypes = query.IncludeItemTypes,
 029            ExcludeItemTypes = query.ExcludeItemTypes,
 030            IncludeItemsByName = !query.ParentId.HasValue || query.ParentId.Value.IsEmpty()
 031        };
 32
 33        // ConfigureUserAccess populates TopParentIds for the libraries the user may open.
 034        libraryManager.ConfigureUserAccess(accessFilter, user);
 35
 036        return accessFilter;
 37    }
 38}