Example #1
0
        private void SetFacet(Expression <Func <T, object> > path, FacetAggregation facetAggregation)
        {
            var last = facets.Last();

            last.Aggregation |= facetAggregation;
            if (facetAggregation == FacetAggregation.Count &&
                string.IsNullOrEmpty(last.AggregationField) == false)
            {
                return;
            }
            if ((string.IsNullOrEmpty(last.AggregationField) == false) && (!last.AggregationField.Equals(path.ToPropertyPath())))
            {
                throw new InvalidOperationException("Cannot call different aggregation function with differentt parameters at the same aggregation. Use AndAggregateOn");
            }

            last.AggregationField = path.ToPropertyPath();
            last.AggregationType  = path.ExtractTypeFromPath().FullName;
        }
Example #2
0
 public double? GetAggregation(FacetAggregation aggregation)
 {
     switch (aggregation)
     {
         case FacetAggregation.None:
             return null;
         case FacetAggregation.Count:
             return Count;
         case FacetAggregation.Max:
             return Max;
         case FacetAggregation.Min:
             return Min;
         case FacetAggregation.Average:
             return Average;
         case FacetAggregation.Sum:
             return Sum;
         default:
             return null;
     }
 }
Example #3
0
 private FacetAggregationToken(string fieldName, FacetAggregation aggregation)
 {
     _fieldName   = fieldName;
     _aggregation = aggregation;
 }
Example #4
0
			private static bool IsAggregationNumerical(FacetAggregation aggregation)
			{
				switch (aggregation)
				{
					case FacetAggregation.Average:
					case FacetAggregation.Count:
					case FacetAggregation.Max:
					case FacetAggregation.Min:
					case FacetAggregation.Sum:
						return true;
					default:
						return false;
				}
			}