コード例 #1
0
        public FhirResponse Search(string type, IEnumerable <Tuple <string, string> > parameters, int pageSize, string sortby)
        {
            Validate.TypeName(type);
            Uri link = localhost.Uri(type);

            IEnumerable <string> keys = store.List(type);
            var    snapshot           = pager.CreateSnapshot(Bundle.BundleType.Searchset, link, keys, sortby);
            Bundle bundle             = pager.GetFirstPage(snapshot);

            return(Respond.WithBundle(bundle, localhost.Base));
            // DSTU2: search

            /*
             * Query query = FhirParser.ParseQueryFromUriParameters(collection, parameters);
             * ICollection<string> includes = query.Includes;
             *
             * SearchResults results = index.Search(query);
             *
             * if (results.HasErrors)
             * {
             *  throw new SparkException(HttpStatusCode.BadRequest, results.Outcome);
             * }
             *
             * Uri link = localhost.Uri(type).AddPath(results.UsedParameters);
             *
             * Bundle bundle = pager.GetFirstPage(link, keys, sortby);
             *
             * /*
             * if (results.HasIssues)
             * {
             *  var outcomeEntry = BundleEntryFactory.CreateFromResource(results.Outcome, new Uri("outcome/1", UriKind.Relative), DateTimeOffset.Now);
             *  outcomeEntry.SelfLink = outcomeEntry.Id;
             *  bundle.Entries.Add(outcomeEntry);
             * }
             * return Respond.WithBundle(bundle);
             */
        }