Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion redisearch/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions redisearch/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down