Skip to content

Commit 194be7d

Browse files
author
Avital-Fine
committed
Support LOAD * in FT.AGGREGATE
1 parent 7a5af81 commit 194be7d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

redisearch/aggregate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery {
204204
//Load document fields from the document HASH objects (if they are not in the sortables)
205205
func (a *AggregateQuery) Load(Properties []string) *AggregateQuery {
206206
nproperties := len(Properties)
207+
if nproperties == 0 {
208+
a.AggregatePlan = a.AggregatePlan.Add("LOAD", "*")
209+
}
207210
if nproperties > 0 {
208211
a.AggregatePlan = a.AggregatePlan.Add("LOAD", nproperties)
209212
for _, property := range Properties {

redisearch/aggregate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ func TestAggregateQuery_Load(t *testing.T) {
616616
args{[]string{"field1", "field2", "field3", "field4"}},
617617
redis.Args{"*", "LOAD", 4, "@field1", "@field2", "@field3", "@field4"},
618618
},
619-
{"TestAggregateQuery_Load_Empty",
619+
{"TestAggregateQuery_Load_All",
620620
fields{nil, redis.Args{}, nil, 0, false, false, false, nil},
621621
args{[]string{}},
622-
redis.Args{"*"},
622+
redis.Args{"*", "LOAD", "*"},
623623
},
624624
}
625625
for _, tt := range tests {

0 commit comments

Comments
 (0)