diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index ff062c1830..13996be19d 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -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;
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 40131b6d20..dd720d043f 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -173,5 +173,13 @@ namespace MediaBrowser.Controller.Library
/// IEnumerable{BaseItem}.
IEnumerable Sort(IEnumerable items, User user, IEnumerable sortBy,
SortOrder sortOrder);
+
+ ///
+ /// Sorts the specified items.
+ ///
+ /// The items.
+ /// The search term.
+ /// IEnumerable{BaseItem}.
+ IEnumerable Search(IEnumerable items, string searchTerm);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 6cd46a3100..b99bc4f974 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -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;
}
+
+ ///
+ /// Sorts the specified items.
+ ///
+ /// The items.
+ /// The search term.
+ /// IEnumerable{BaseItem}.
+ public IEnumerable Search(IEnumerable items, string searchTerm)
+ {
+ if (string.IsNullOrEmpty(searchTerm))
+ {
+ throw new ArgumentNullException("searchTerm");
+ }
+
+ return items.Where(i => i.Name.StartsWith(searchTerm, StringComparison.OrdinalIgnoreCase));
+ }
}
}