当前位置: 首页>>代码示例>>C#>>正文


C# GetResponse.Select方法代码示例

本文整理汇总了C#中Raven.Abstractions.Data.GetResponse.Select方法的典型用法代码示例。如果您正苦于以下问题:C# GetResponse.Select方法的具体用法?C# GetResponse.Select怎么用?C# GetResponse.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Abstractions.Data.GetResponse的用法示例。


在下文中一共展示了GetResponse.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleResponses

		public void HandleResponses(GetResponse[] responses, ShardStrategy shardStrategy)
		{
			var result = new FacetResults();

			foreach (var response in responses.Select(response => (RavenJObject)response.Result))
			{
				var facet = response.JsonDeserialization<FacetResults>();
				foreach (var facetResult in facet.Results)
				{
					if (!result.Results.ContainsKey(facetResult.Key))
						result.Results[facetResult.Key] = new FacetResult();

					var newFacetResult = result.Results[facetResult.Key];
					foreach (var facetValue in facetResult.Value.Values)
					{
						var existingFacetValueRange = newFacetResult.Values.Find((x) => x.Range == facetValue.Range);
						if (existingFacetValueRange != null)
							existingFacetValueRange.Hits += facetValue.Hits;
						else
							newFacetResult.Values.Add(new FacetValue() { Hits = facetValue.Hits, Range = facetValue.Range });
					}

					foreach (var facetTerm in facetResult.Value.RemainingTerms)
					{
						if (!newFacetResult.RemainingTerms.Contains(facetTerm))
							newFacetResult.RemainingTerms.Add(facetTerm);
					}
				}
			}

			Result = result;
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:32,代码来源:LazyFacetsOperation.cs

示例2: HandleResponses

		public void HandleResponses(GetResponse[] responses, ShardStrategy shardStrategy)
		{
			var result = new SuggestionQueryResult
			{
				Suggestions = responses
					.Select(item => RavenJObject.Parse(item.Result))
					.SelectMany(data => ((RavenJArray) data["Suggestions"]).Select(x => x.Value<string>()))
					.Distinct()
					.ToArray()
			};

			Result = result;
		}
开发者ID:robinminto,项目名称:ravendb,代码行数:13,代码来源:LazySuggestOperation.cs

示例3: HandleResponses

		public void HandleResponses(GetResponse[] responses, ShardStrategy shardStrategy)
		{
			var result = new Dictionary<string, IEnumerable<FacetValue>>();

			IEnumerable<IGrouping<string, KeyValuePair<string, IEnumerable<FacetValue>>>> list = responses.Select(response => RavenJObject.Parse(response.Result))
				.SelectMany(jsonResult => jsonResult.JsonDeserialization<IDictionary<string, IEnumerable<FacetValue>>>())
				.GroupBy(x => x.Key);

			foreach (var facet in list)
			{
				var individualFacet = facet.SelectMany(x=>x.Value).GroupBy(x=>x.Range)
					.Select(g=>new FacetValue
					{
						Count = g.Sum(y=>y.Count),
						Range = g.Key
					});
				result[facet.Key] = individualFacet.ToList();
			}

			Result = result;
		}
开发者ID:robinminto,项目名称:ravendb,代码行数:21,代码来源:LazyFacetsOperation.cs


注:本文中的Raven.Abstractions.Data.GetResponse.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。