diff --git a/redisearch/aggregate.go b/redisearch/aggregate.go index f883b5f..c6bcbd2 100644 --- a/redisearch/aggregate.go +++ b/redisearch/aggregate.go @@ -201,9 +201,13 @@ 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 { + 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 {