コード例 #1
0
        // Given a set of version id's, go fetch a subset of them from the store and build a Bundle
        private Bundle createBundle(Snapshot snapshot, int start, int count)
        {
            var entryVersionIds = snapshot.Contents.Skip(start).Take(count).ToList();
            var pageContents    = _store.FindByVersionIds(entryVersionIds).ToList();

            var resultBundle =
                BundleEntryFactory.CreateBundleWithEntries(snapshot.FeedTitle, new Uri(snapshot.FeedSelfLink),
                                                           "Spark MatchBox Search Engine", null, pageContents);

            if (snapshot.MatchCount != Snapshot.NOCOUNT)
            {
                resultBundle.TotalResults = snapshot.MatchCount;
            }
            else
            {
                resultBundle.TotalResults = null;
            }

            // If we need paging, add the paging links
            if (snapshot.Contents.Count() > count)
            {
                buildLinks(resultBundle, snapshot.Id, start, count, resultBundle.TotalResults.Value);
            }

            return(resultBundle);
        }