I have just been using redis cli for a few weeks ago.
This is something that I wish to recreate in C# using nRediSearch for my json schema.
In redis cli:
FT.AGGREGATE ResultSearch "@desc:A1A3 AND @optionID:1" GROUPBY 2 @itemId @categoryId REDUCE SUM 1 @priceValue as total_PriceValue SORTBY 2 @itemId ASC TIMEOUT 10000
My attempt in C#:
var groupStr = new List();
groupStr.Add("@itemId");
groupStr.Add("@categoryId");
var agg = new AggregationBuilder()
.Filter("@desc:A1A3 AND @optionID:1")
.GroupBy(groupStr, new List<Reducer> {Reducers.Sum("priceValue").As("total_PriceValue") })
.SortBy(SortedField.Ascending("@itemId"));
It fails saying :
Message=Syntax error at offset 8 near 'A1A3'
Source=StackExchange.Redis
I definitely missed something, please correct me...
I have found the solution :)
var agg = new AggregationBuilder("@desc:A1A3 AND @optionID:1")
.GroupBy(groupStr, new List {Reducers.Sum("priceValue").As("total_PriceValue") })
.SortBy(SortedField.Ascending("@itemId"));
Hi,
I have just been using redis cli for a few weeks ago. This is something that I wish to recreate in C# using nRediSearch for my json schema.
In redis cli: FT.AGGREGATE ResultSearch "@desc:A1A3 AND @optionID:1" GROUPBY 2 @itemId @categoryId REDUCE SUM 1 @priceValue as total_PriceValue SORTBY 2 @itemId ASC TIMEOUT 10000
My attempt in C#: var groupStr = new List();
groupStr.Add("@itemId");
groupStr.Add("@categoryId");
It fails saying : Message=Syntax error at offset 8 near 'A1A3' Source=StackExchange.Redis
I definitely missed something, please correct me...
Thank you,
Eko