mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Moved search placeholder
This commit is contained in:
parent
67df3be368
commit
5c460c0b6f
@ -122,15 +122,19 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// The _library manager
|
/// The _library manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
private readonly ILibrarySearchEngine _searchEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemsService" /> class.
|
/// Initializes a new instance of the <see cref="ItemsService" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
public ItemsService(IUserManager userManager, ILibraryManager libraryManager)
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
|
/// <param name="searchEngine">The search engine.</param>
|
||||||
|
public ItemsService(IUserManager userManager, ILibraryManager libraryManager, ILibrarySearchEngine searchEngine)
|
||||||
{
|
{
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
_searchEngine = searchEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -400,7 +404,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(term))
|
if (!string.IsNullOrEmpty(term))
|
||||||
{
|
{
|
||||||
items = _libraryManager.Search(items, request.SearchTerm);
|
items = _searchEngine.Search(items, request.SearchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -174,14 +174,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy,
|
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy,
|
||||||
SortOrder sortOrder);
|
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);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensure supplied item has only one instance throughout
|
/// Ensure supplied item has only one instance throughout
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
19
MediaBrowser.Controller/Library/ILibrarySearchEngine.cs
Normal file
19
MediaBrowser.Controller/Library/ILibrarySearchEngine.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface ILibrarySearchEngine
|
||||||
|
/// </summary>
|
||||||
|
public interface ILibrarySearchEngine
|
||||||
|
{
|
||||||
|
/// <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);
|
||||||
|
}
|
||||||
|
}
|
@ -88,6 +88,7 @@
|
|||||||
<Compile Include="Entities\Movies\BoxSet.cs" />
|
<Compile Include="Entities\Movies\BoxSet.cs" />
|
||||||
<Compile Include="Entities\Movies\Movie.cs" />
|
<Compile Include="Entities\Movies\Movie.cs" />
|
||||||
<Compile Include="Entities\Person.cs" />
|
<Compile Include="Entities\Person.cs" />
|
||||||
|
<Compile Include="Library\ILibrarySearchEngine.cs" />
|
||||||
<Compile Include="Library\PlaybackProgressEventArgs.cs" />
|
<Compile Include="Library\PlaybackProgressEventArgs.cs" />
|
||||||
<Compile Include="Entities\Studio.cs" />
|
<Compile Include="Entities\Studio.cs" />
|
||||||
<Compile Include="Entities\Trailer.cs" />
|
<Compile Include="Entities\Trailer.cs" />
|
||||||
|
@ -817,21 +817,5 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
return comparer;
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class LuceneSearchEngine
|
||||||
|
/// http://www.codeproject.com/Articles/320219/Lucene-Net-ultra-fast-search-for-MVC-or-WebForms
|
||||||
|
/// </summary>
|
||||||
|
public class LuceneSearchEngine : ILibrarySearchEngine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Sorts the specified items.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items">The items.</param>
|
||||||
|
/// <param name="searchTerm">The search term.</param>
|
||||||
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
|
/// <exception cref="System.ArgumentNullException">searchTerm</exception>
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -125,6 +125,7 @@
|
|||||||
<Compile Include="IO\DirectoryWatchers.cs" />
|
<Compile Include="IO\DirectoryWatchers.cs" />
|
||||||
<Compile Include="Library\CoreResolutionIgnoreRule.cs" />
|
<Compile Include="Library\CoreResolutionIgnoreRule.cs" />
|
||||||
<Compile Include="Library\LibraryManager.cs" />
|
<Compile Include="Library\LibraryManager.cs" />
|
||||||
|
<Compile Include="Library\LuceneSearchEngine.cs" />
|
||||||
<Compile Include="Library\ResolverHelper.cs" />
|
<Compile Include="Library\ResolverHelper.cs" />
|
||||||
<Compile Include="Library\Resolvers\Audio\AudioResolver.cs" />
|
<Compile Include="Library\Resolvers\Audio\AudioResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
|
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
|
||||||
|
@ -212,6 +212,8 @@ namespace MediaBrowser.ServerApplication
|
|||||||
ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, DirectoryWatchers, LogManager);
|
ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, DirectoryWatchers, LogManager);
|
||||||
RegisterSingleInstance(ProviderManager);
|
RegisterSingleInstance(ProviderManager);
|
||||||
|
|
||||||
|
RegisterSingleInstance<ILibrarySearchEngine>(() => new LuceneSearchEngine());
|
||||||
|
|
||||||
SetKernelProperties();
|
SetKernelProperties();
|
||||||
SetStaticProperties();
|
SetStaticProperties();
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,16 @@
|
|||||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
|
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
|
||||||
<HintPath>..\packages\Hardcodet.Wpf.TaskbarNotification.1.0.4.0\lib\net40\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
<HintPath>..\packages\Hardcodet.Wpf.TaskbarNotification.1.0.4.0\lib\net40\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="ICSharpCode.SharpZipLib">
|
||||||
|
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
|
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath>
|
<HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Lucene.Net">
|
||||||
|
<HintPath>..\packages\Lucene.Net.3.0.3\lib\NET40\Lucene.Net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.IsoMounter, Version=1.0.4827.21973, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.IsoMounter, Version=1.0.4827.21973, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.51\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.51\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
|
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
|
||||||
<package id="Hardcodet.Wpf.TaskbarNotification" version="1.0.4.0" targetFramework="net45" />
|
<package id="Hardcodet.Wpf.TaskbarNotification" version="1.0.4.0" targetFramework="net45" />
|
||||||
|
<package id="Lucene.Net" version="3.0.3" targetFramework="net45" />
|
||||||
<package id="MediaBrowser.IsoMounting" version="3.0.51" targetFramework="net45" />
|
<package id="MediaBrowser.IsoMounting" version="3.0.51" targetFramework="net45" />
|
||||||
<package id="NLog" version="2.0.0.2000" targetFramework="net45" />
|
<package id="NLog" version="2.0.0.2000" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.42" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.42" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.42" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.42" targetFramework="net45" />
|
||||||
|
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
|
||||||
<package id="SimpleInjector" version="2.0.0-beta5" targetFramework="net45" />
|
<package id="SimpleInjector" version="2.0.0-beta5" targetFramework="net45" />
|
||||||
<package id="System.Data.SQLite" version="1.0.84.0" targetFramework="net45" />
|
<package id="System.Data.SQLite" version="1.0.84.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in New Issue
Block a user