示例#1
0
        public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease)
        {
            var packages = PackageRepository.GetAll()
                           .Include(p => p.PackageRegistration)
                           .Include(p => p.PackageRegistration.Owners)
                           .Where(p => p.Listed);

            return(SearchAdaptor.SearchCore(SearchService, HttpContext.Request, SiteRoot, packages, searchTerm, targetFramework, includePrerelease, curatedFeedKey: null).ToV2FeedPackageQuery(GetSiteRoot()));
        }
示例#2
0
        public IQueryable <V1FeedPackage> Search(string searchTerm, string targetFramework)
        {
            var packages = PackageRepository.GetAll()
                           .Include(p => p.PackageRegistration)
                           .Include(p => p.PackageRegistration.Owners)
                           .Where(p => p.Listed && !p.IsPrerelease);

            // For v1 feed, only allow stable package versions.
            packages = SearchAdaptor.SearchCore(SearchService, HttpContext.Request, packages, searchTerm, targetFramework, includePrerelease: false, curatedFeedKey: null);
            return(packages.ToV1FeedPackageQuery(Configuration.GetSiteRoot(UseHttps())));
        }
示例#3
0
        private IQueryable <V2FeedPackage> SearchV2FeedCore(string searchTerm, string targetFramework, bool includePrerelease)
        {
            var packages = PackageRepository.GetAll()
                           .Include(p => p.PackageRegistration)
                           .Include(p => p.PackageRegistration.Owners)
                           .Where(p => !p.Deleted && p.Listed);

            var query = SearchAdaptor.SearchCore(SearchService, HttpContext.Request, packages, searchTerm, targetFramework, includePrerelease, curatedFeed: null)
                        // TODO: Async this when I can figure out OData async stuff...
                        .Result
                        .ToV2FeedPackageQuery(GetSiteRoot(), Configuration.Features.FriendlyLicenses);

            return(query);
        }
示例#4
0
            private async Task TestOrderBy(string queryString, SortOrder?expected)
            {
                RawUrl += "&" + queryString;

                var result = await SearchAdaptor.SearchCore(
                    SearchService.Object,
                    Request.Object,
                    Packages,
                    SearchTerm,
                    TargetFramework,
                    IncludePrerelease,
                    SemVerLevel);

                VerifySortOrder(expected);
            }
        public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease)
        {
            var curatedFeedName = GetCuratedFeedName();
            var curatedFeedKey  = _curatedFeedService.GetKey(curatedFeedName);

            if (curatedFeedKey == null)
            {
                throw new DataServiceException(404, "Not Found");
            }

            var curatedPackages = _curatedFeedService.GetPackages(curatedFeedName);

            return(SearchAdaptor.SearchCore(SearchService, HttpContext.Request, SiteRoot, curatedPackages, searchTerm, targetFramework, includePrerelease, curatedFeedKey: curatedFeedKey)
                   .ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps())));
        }
示例#6
0
        public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease)
        {
            // Handle OData-style |-separated list of frameworks.
            string[] targetFrameworkList = (targetFramework ?? "").Split(new[] { '\'', '|' }, StringSplitOptions.RemoveEmptyEntries);

            // For now, we'll just filter on the first one.
            if (targetFrameworkList.Length > 0)
            {
                // Until we support multiple frameworks, we need to prefer aspnet50 over aspnetcore50.
                if (targetFrameworkList.Contains("aspnet50"))
                {
                    targetFramework = "aspnet50";
                }
                else
                {
                    targetFramework = targetFrameworkList[0];
                }
            }

            var packages = PackageRepository.GetAll()
                           .Include(p => p.PackageRegistration)
                           .Include(p => p.PackageRegistration.Owners)
                           .Where(p => p.Listed);
            var query = SearchAdaptor.SearchCore(
                SearchService,
                HttpContext.Request,
                packages,
                searchTerm,
                targetFramework,
                includePrerelease,
                curatedFeed: null)
                        // TODO: Async this when I can figure out OData async stuff...
                        .Result
                        .ToV2FeedPackageQuery(GetSiteRoot(), Configuration.Features.FriendlyLicenses);
            var result = query.ToList();

            return(query);
        }
        public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease)
        {
            var curatedFeedName = GetCuratedFeedName();
            var curatedFeed     = _curatedFeedService.GetFeedByName(curatedFeedName, includePackages: false);

            if (curatedFeed == null)
            {
                throw new DataServiceException(404, "Not Found");
            }

            var curatedPackages = _curatedFeedService.GetPackages(curatedFeedName);

            return(SearchAdaptor.SearchCore(
                       SearchService,
                       HttpContext.Request,
                       curatedPackages,
                       searchTerm,
                       targetFramework,
                       includePrerelease,
                       curatedFeed)
                   // TODO: Async this when I can figure out OData async stuff...
                   .Result
                   .ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()), Configuration.Features.FriendlyLicenses));
        }