using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using System; using System.Collections.Generic; using System.Linq; namespace MediaBrowser.Server.Implementations.Library { /// /// Class LuceneSearchEngine /// http://www.codeproject.com/Articles/320219/Lucene-Net-ultra-fast-search-for-MVC-or-WebForms /// public class LuceneSearchEngine : ILibrarySearchEngine { /// /// Searches items and returns them in order of relevance. /// /// The items. /// The search term. /// IEnumerable{BaseItem}. /// searchTerm public IEnumerable Search(IEnumerable items, string searchTerm) { if (string.IsNullOrEmpty(searchTerm)) { throw new ArgumentNullException("searchTerm"); } return items.Where(i => i.Name.IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase) != -1); } } }