本文整理汇总了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;
}
示例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;
}
示例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;
}