/// <summary>
 /// terms_stats and terms facet responses have each field in an independent object with all
 /// possible operations for that field. Multiple fields means multiple objects
 /// each of which might not have all possible terms. Convert that structure into
 /// an SQL-style row with one term per row containing each aggregate field and operation combination.
 /// </summary>
 /// <param name="termsStats">Facets of type terms or terms_stats.</param>
 /// <returns>An enumeration of AggregateRows containing appropriate keys and fields.</returns>
 internal IEnumerable <AggregateTermRow> FlattenTermsToAggregateRows(IEnumerable <JToken> termsStats)
 {
     return(termsStats
            .SelectMany(t => t["terms"])
            .GroupBy(t => t["term"])
            .Select(g => new AggregateTermRow(AggregateRow.ParseValue(g.Key, groupKeyType), g.SelectMany(CreateAggregateFields))));
 }
Ejemplo n.º 2
0
        internal static object GetKey(AggregateRow row)
        {
            if (row is AggregateTermRow)
                return ((AggregateTermRow)row).Key;

            if (row is AggregateStatisticalRow)
                return ((AggregateStatisticalRow)row).Key;

            return null;
        }
Ejemplo n.º 3
0
        internal static object GetKey(AggregateRow row)
        {
            if (row is AggregateTermRow)
            {
                return(((AggregateTermRow)row).Key);
            }

            if (row is AggregateStatisticalRow)
            {
                return(((AggregateStatisticalRow)row).Key);
            }

            return(null);
        }
Ejemplo n.º 4
0
 internal static object GetValue(AggregateRow row, string name, string operation, Type valueType)
 {
     return(row.GetValue(name, operation, valueType));
 }
Ejemplo n.º 5
0
 internal static object GetValue(AggregateRow row, string name, string operation, Type valueType)
 {
     return row.GetValue(name, operation, valueType);
 }