redis / rueidis

A fast Golang Redis client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, etc.
Apache License 2.0
2.34k stars 149 forks source link

FT.AGGREGATE - Can you add an option to LOAD and LOAD ALL after FILTER command #169

Closed nadavtsa closed 1 year ago

nadavtsa commented 1 year ago

I want to be able to implement the logic in this https://github.com/RediSearch/RediSearch/issues/3229 (just scroll down to the bottom of the thread - I want to do a sort of "elem match" in a list of json objects). I basiccally want to run the following command (which I tested with redis-cli and seems to be working):

FT.AGGREGATE idx:user "@orders_no:ord001 @orders_id:[2 2]" LOAD 3 '$.orders[?(@.no=="ord001" && @.id==2)]' as match FILTER 'exists(@match)' LOAD *

From looking at your code I think all you need is to add the following receiver to /internal/cmds/gen.go:

func (c FtAggregateOpFilter) LoadAll() FtAggregateLoadallLoadAll {
    c.cs.s = append(c.cs.s, "LOAD", "*")
    return (FtAggregateLoadallLoadAll)(c)
}
rueian commented 1 year ago

Sure, I have made changes in https://github.com/rueian/rueidis/commit/db6fa061bfdbd4396347ae358b4e62bb29412476 so that you will able to use LOAD after FILTER in the next version.

rueian commented 1 year ago

Hi @nadavtsa,

https://github.com/rueian/rueidis/commit/db6fa061bfdbd4396347ae358b4e62bb29412476 is released in v0.0.93.