Skip to content

Commit d5b6b35

Browse files
authored
Support LOAD * in FT.AGGREGATE (#147)
* Support LOAD * in FT.AGGREGATE * document * add point
1 parent 23c6554 commit d5b6b35

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

redisearch/aggregate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,13 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery {
201201
return a
202202
}
203203

204-
//Load document fields from the document HASH objects (if they are not in the sortables)
204+
//Load document fields from the document HASH objects (if they are not in the sortables).
205+
//Empty array will load all properties.
205206
func (a *AggregateQuery) Load(Properties []string) *AggregateQuery {
206207
nproperties := len(Properties)
208+
if nproperties == 0 {
209+
a.AggregatePlan = a.AggregatePlan.Add("LOAD", "*")
210+
}
207211
if nproperties > 0 {
208212
a.AggregatePlan = a.AggregatePlan.Add("LOAD", nproperties)
209213
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)