From 194be7da7ae2f59c7b7cf51befe9777281ada174 Mon Sep 17 00:00:00 2001 From: Avital-Fine Date: Tue, 5 Apr 2022 16:14:34 +0300 Subject: [PATCH 1/3] Support LOAD * in FT.AGGREGATE --- redisearch/aggregate.go | 3 +++ redisearch/aggregate_test.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/redisearch/aggregate.go b/redisearch/aggregate.go index f883b5f..035e2b5 100644 --- a/redisearch/aggregate.go +++ b/redisearch/aggregate.go @@ -204,6 +204,9 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery { //Load document fields from the document HASH objects (if they are not in the sortables) func (a *AggregateQuery) Load(Properties []string) *AggregateQuery { nproperties := len(Properties) + if nproperties == 0 { + a.AggregatePlan = a.AggregatePlan.Add("LOAD", "*") + } if nproperties > 0 { a.AggregatePlan = a.AggregatePlan.Add("LOAD", nproperties) for _, property := range Properties { diff --git a/redisearch/aggregate_test.go b/redisearch/aggregate_test.go index 08307e9..19cf2f1 100644 --- a/redisearch/aggregate_test.go +++ b/redisearch/aggregate_test.go @@ -616,10 +616,10 @@ func TestAggregateQuery_Load(t *testing.T) { args{[]string{"field1", "field2", "field3", "field4"}}, redis.Args{"*", "LOAD", 4, "@field1", "@field2", "@field3", "@field4"}, }, - {"TestAggregateQuery_Load_Empty", + {"TestAggregateQuery_Load_All", fields{nil, redis.Args{}, nil, 0, false, false, false, nil}, args{[]string{}}, - redis.Args{"*"}, + redis.Args{"*", "LOAD", "*"}, }, } for _, tt := range tests { From c153f9fadf02f0d91c6279ba4386467be07be44d Mon Sep 17 00:00:00 2001 From: Avital-Fine Date: Tue, 5 Apr 2022 16:34:42 +0300 Subject: [PATCH 2/3] document --- redisearch/aggregate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redisearch/aggregate.go b/redisearch/aggregate.go index 035e2b5..e843ab9 100644 --- a/redisearch/aggregate.go +++ b/redisearch/aggregate.go @@ -201,7 +201,8 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery { return a } -//Load document fields from the document HASH objects (if they are not in the sortables) +//Load document fields from the document HASH objects (if they are not in the sortables). +//Empty array will load all properties func (a *AggregateQuery) Load(Properties []string) *AggregateQuery { nproperties := len(Properties) if nproperties == 0 { From a22baaff84d859b12167deac3f9dfb0695a889f2 Mon Sep 17 00:00:00 2001 From: Avital-Fine Date: Tue, 5 Apr 2022 16:35:40 +0300 Subject: [PATCH 3/3] add point --- redisearch/aggregate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redisearch/aggregate.go b/redisearch/aggregate.go index e843ab9..c6bcbd2 100644 --- a/redisearch/aggregate.go +++ b/redisearch/aggregate.go @@ -202,7 +202,7 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery { } //Load document fields from the document HASH objects (if they are not in the sortables). -//Empty array will load all properties +//Empty array will load all properties. func (a *AggregateQuery) Load(Properties []string) *AggregateQuery { nproperties := len(Properties) if nproperties == 0 {