Added LibraryManager.Search
This commit is contained in:
parent
7f2716bd0d
commit
3f44324623
|
@ -387,7 +387,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
if (!string.IsNullOrEmpty(term))
|
||||
{
|
||||
items = items.Where(i => i.Name.StartsWith(term, StringComparison.OrdinalIgnoreCase));
|
||||
items = _libraryManager.Search(items, request.SearchTerm);
|
||||
}
|
||||
|
||||
return items;
|
||||
|
|
|
@ -173,5 +173,13 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy,
|
||||
SortOrder sortOrder);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the specified items.
|
||||
/// </summary>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="searchTerm">The search term.</param>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
IEnumerable<BaseItem> Search(IEnumerable<BaseItem> items, string searchTerm);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller;
|
||||
|
@ -12,7 +11,6 @@ using MediaBrowser.Controller.ScheduledTasks;
|
|||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations.Library.Resolvers;
|
||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||
using MoreLinq;
|
||||
using System;
|
||||
|
@ -769,5 +767,21 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
return comparer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the specified items.
|
||||
/// </summary>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="searchTerm">The search term.</param>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
public IEnumerable<BaseItem> Search(IEnumerable<BaseItem> items, string searchTerm)
|
||||
{
|
||||
if (string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
throw new ArgumentNullException("searchTerm");
|
||||
}
|
||||
|
||||
return items.Where(i => i.Name.StartsWith(searchTerm, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user