コード例 #1
0
        public ArticleInfo[] GetTopN(UserInfo userInfo, int topN)
        {
            var articleIdList  = _hitDao.GetResourceIds(0, topN, HitType.Article);
            var articleIds     = articleIdList.Cast <int>().ToList();
            var articles       = _articleDao.Get(articleIds);
            var sortedArticles = SortArticles(articles, articleIds);

            return(_articleConverter.ToDataTransferObject(sortedArticles));
        }
コード例 #2
0
        public PageOf <ArticleInfo> Search(UserInfo user, QueryPackage queryPackage, int pageIndex, int pageSize)
        {
            var keyword   = queryPackage.QueryString;
            var sorting   = _sortingConverter.ToDomainObject(queryPackage.SortingInfo);
            var startDate = queryPackage.StartDate;
            var endDate   = queryPackage.EndDate;

            var articles = _searchDao.Search(
                keyword,
                sorting,
                startDate,
                endDate,
                pageIndex,
                pageSize);

            var articleInfos = _articleConverter.ToDataTransferObject(articles);

            return(new PageOf <ArticleInfo>()
            {
                TotalCount = _searchDao.GetTotalCount(keyword, sorting, startDate, endDate),
                PageSize = pageSize,
                PageIndex = pageIndex,
                Results = articleInfos
            });
        }