@@ -14,24 +14,35 @@ public partial class AggregateDictionary
14
14
15
15
public bool IsEmptyTerms ( string key ) => ! BackingDictionary . TryGetValue ( key , out var agg ) || agg is EmptyTermsAggregate ;
16
16
17
- public bool TryGetStringTerms ( string key , out StringTermsAggregate ? aggregate )
18
- {
19
- aggregate = null ;
20
-
21
- if ( BackingDictionary . TryGetValue ( key , out var agg ) && agg is StringTermsAggregate stringTermsAgg )
22
- {
23
- aggregate = stringTermsAgg ;
24
- return true ;
25
- }
26
-
27
- return false ;
28
- }
29
-
30
- public AvgAggregate ? Average ( string key ) => TryGet < AvgAggregate ? > ( key ) ;
31
-
32
- public TermsAggregate < string > Terms ( string key ) => Terms < string > ( key ) ;
33
-
34
- public TermsAggregate < TKey > Terms < TKey > ( string key )
17
+ // This should be autogenerated if we want to include this.
18
+ //public bool TryGetStringTerms(string key, out StringTermsAggregate? aggregate)
19
+ //{
20
+ // aggregate = null;
21
+
22
+ // if (BackingDictionary.TryGetValue(key, out var agg) && agg is StringTermsAggregate stringTermsAgg)
23
+ // {
24
+ // aggregate = stringTermsAgg;
25
+ // return true;
26
+ // }
27
+
28
+ // return false;
29
+ //}
30
+
31
+ public AvgAggregate ? GetAverage ( string key ) => TryGet < AvgAggregate ? > ( key ) ;
32
+
33
+ /// <summary>
34
+ /// WARNING: EXPERIMENTAL API
35
+ /// <para>This API provides simplified access to terms aggregations.</para>
36
+ /// </summary>
37
+ /// <remarks>Experimental APIs are subject to changes or removal and should be used with caution.</remarks>
38
+ public TermsAggregate < string > GetTerms ( string key ) => GetTerms < string > ( key ) ;
39
+
40
+ /// <summary>
41
+ /// WARNING: EXPERIMENTAL API
42
+ /// <para>This API provides simplified access to terms aggregations.</para>
43
+ /// </summary>
44
+ /// <remarks>Experimental APIs are subject to changes or removal and should be used with caution.</remarks>
45
+ public TermsAggregate < TKey > GetTerms < TKey > ( string key )
35
46
{
36
47
if ( ! BackingDictionary . TryGetValue ( key , out var agg ) )
37
48
{
@@ -59,12 +70,12 @@ public TermsAggregate<TKey> Terms<TKey>(string key)
59
70
{
60
71
var key = item . Key ;
61
72
var value = item . Value ;
62
- dict . Add ( key , new TermsBucket < TKey > { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . Key } ) ;
73
+ dict . Add ( key , new TermsBucket < TKey > ( value . BackingDictionary ) { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . Key } ) ;
63
74
}
64
75
buckets = new ( dict ) ;
65
76
} , a =>
66
77
{
67
- buckets = new ( a . Select ( b => new TermsBucket < TKey > { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . Key } ) . ToReadOnlyCollection ( ) ) ;
78
+ buckets = new ( a . Select ( b => new TermsBucket < TKey > ( b . BackingDictionary ) { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . Key } ) . ToReadOnlyCollection ( ) ) ;
68
79
} ) ;
69
80
70
81
return new TermsAggregate < TKey >
@@ -83,12 +94,12 @@ public TermsAggregate<TKey> Terms<TKey>(string key)
83
94
{
84
95
var key = item . Key ;
85
96
var value = item . Value ;
86
- dict . Add ( key , new TermsBucket < TKey > { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . KeyAsString } ) ;
97
+ dict . Add ( key , new TermsBucket < TKey > ( value . BackingDictionary ) { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . KeyAsString } ) ;
87
98
}
88
99
buckets = new ( dict ) ;
89
100
} , a =>
90
101
{
91
- buckets = new ( a . Select ( b => new TermsBucket < TKey > { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . KeyAsString } ) . ToReadOnlyCollection ( ) ) ;
102
+ buckets = new ( a . Select ( b => new TermsBucket < TKey > ( b . BackingDictionary ) { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . KeyAsString } ) . ToReadOnlyCollection ( ) ) ;
92
103
} ) ;
93
104
94
105
return new TermsAggregate < TKey >
@@ -107,12 +118,12 @@ public TermsAggregate<TKey> Terms<TKey>(string key)
107
118
{
108
119
var key = item . Key ;
109
120
var value = item . Value ;
110
- dict . Add ( key , new TermsBucket < TKey > { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . KeyAsString } ) ;
121
+ dict . Add ( key , new TermsBucket < TKey > ( value . BackingDictionary ) { DocCount = value . DocCount , DocCountError = value . DocCountError , Key = GetKeyFromBucketKey < TKey > ( value . Key ) , KeyAsString = value . KeyAsString } ) ;
111
122
}
112
123
buckets = new ( dict ) ;
113
124
} , a =>
114
125
{
115
- buckets = new ( a . Select ( b => new TermsBucket < TKey > { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . KeyAsString } ) . ToReadOnlyCollection ( ) ) ;
126
+ buckets = new ( a . Select ( b => new TermsBucket < TKey > ( b . BackingDictionary ) { DocCount = b . DocCount , DocCountError = b . DocCountError , Key = GetKeyFromBucketKey < TKey > ( b . Key ) , KeyAsString = b . KeyAsString } ) . ToReadOnlyCollection ( ) ) ;
116
127
} ) ;
117
128
118
129
return new TermsAggregate < TKey >
0 commit comments