public IEnumerable<Album> SearchAlbums(AlbumSearchCriteria searchCriteria)
        {
            var startsWith = UnitOfWork.Albums.GetAll(x => x.Name.StartsWith(searchCriteria.NameFilter, true, null));
            var contains = UnitOfWork.Albums.GetAll(x => x.Name.ToLower().Contains(searchCriteria.NameFilter.ToLower()));

            return startsWith.Union(contains, new EntityComparer<AlbumEntity>()).Select(album => album.ToModel());
        }
Пример #2
0
        public IndexerPageableRequestChain GetSearchRequests(AlbumSearchCriteria searchCriteria)
        {
            var pageableRequests = new IndexerPageableRequestChain();

            pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format(" & type=name&query={0}+{1}", Uri.EscapeDataString(searchCriteria.ArtistQuery.Trim()), Uri.EscapeDataString(searchCriteria.AlbumQuery.Trim()))));

            return(pageableRequests);
        }
Пример #3
0
        public IndexerPageableRequestChain GetSearchRequests(AlbumSearchCriteria searchCriteria)
        {
            var chain = new IndexerPageableRequestChain();

            chain.AddTier(GetRequests($"artist:\"{searchCriteria.ArtistQuery}\" album:\"{searchCriteria.AlbumQuery}\""));
            chain.AddTier(GetRequests($"{searchCriteria.ArtistQuery} {searchCriteria.AlbumQuery}"));

            return(chain);
        }