コード例 #1
0
        public SearchifyAggregationConfigurer <TAggregation> WithDisplayName(string displayName)
        {
            var fd = new FluentDictionary <string, object>(descriptor.Meta);

            fd.AddOrUpdate(SearchifyFilterExtensions.AggregationDisplayNameKey, displayName, v => !string.IsNullOrWhiteSpace(displayName));
            descriptor.Meta = fd;

            return(this);
        }
コード例 #2
0
        public static TAggregation AsSearchifyFilter <TAggregation>(this TAggregation descriptor, Action <SearchifyAggregationConfigurer <TAggregation> > configure = null)
            where TAggregation : class, IAggregation
        {
            var typeName = ResolveAggregationTypeName(descriptor);

            if (string.IsNullOrWhiteSpace(typeName))
            {
                throw new NotSupportedException("Unfortunately this aggregation is not currently supported by the searchify filter abstraction, raise an issue if you would like to see it included");
            }
            var config = new SearchifyAggregationConfigurer <TAggregation>(descriptor);

            configure?.Invoke(config);

            var fd = new FluentDictionary <string, object>(descriptor.Meta);

            fd.AddOrUpdate(nameof(AggregationFilterModel <SearchParameters> .Type), typeName);
            descriptor.Meta = fd;
            return(descriptor);
        }