private static ReduceTree RenderNestedSection(NestedMapResultsSection section, List <MapEntry> mapEntries, string sourceDocId, Index index, TransactionOperationContext context) { var entries = new Dictionary <long, BlittableJsonReaderObject>(); var root = new ReduceTreePage(section.RelevantPage); root.AggregationResult = GetReduceResult(mapEntries[0].ReduceKeyHash, index, context); section.GetResultsForDebug(context, entries); foreach (var item in entries) { var entry = new MapResultInLeaf { Data = item.Value }; foreach (var mapEntry in mapEntries) { if (item.Key == mapEntry.Id) { entry.Source = sourceDocId; break; } } root.Entries.Add(entry); } return(new ReduceTree { DisplayName = GetTreeName(root.AggregationResult, index.Definition, context), Name = section.Name.ToString(), Root = root, Depth = 1, PageCount = 1, NumberOfEntries = entries.Count }); }
private static ReduceTree RenderNestedSection(NestedMapResultsSection section, ulong reduceKeyHash, Dictionary <long, string> idToDocIdHash, Index index, TransactionOperationContext context) { var entries = new Dictionary <long, BlittableJsonReaderObject>(); var root = new ReduceTreePage(section.RelevantPage); root.AggregationResult = GetReduceResult(reduceKeyHash, index, context); section.GetResultsForDebug(context, entries); foreach (var item in entries) { var entry = new MapResultInLeaf { Data = item.Value }; var id = Bits.SwapBytes(item.Key); if (idToDocIdHash.TryGetValue(id, out string docId)) { entry.Source = docId; } root.Entries.Add(entry); } return(new ReduceTree { DisplayName = GetTreeName(root.AggregationResult, index.Definition, context), Name = section.Name.ToString(), Root = root, Depth = 1, PageCount = 1, NumberOfEntries = entries.Count }); }