node.jsredisioredis

How can I call a command with redis.call which won't wrap by quotes


I want to write some custom Redis JSON commands and wish to add LIMIT after it. but redis.call command simply wrapping my LIMIT query under quotes too. How to get rid of it.

My command: FT.SEARCH idx:tasks "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8}" LIMIT 10 30 in IOREDIS: redis.call("FT.SEARCH", "idx:tasks", "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8}", "LIMIT 10 30") which is not working. as LIMIT is being wrapped by a "quotes"

IOredis generating a query like this : "FT.SEARCH" "idx:tasks" "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8}" "LIMIT 10 30", But I need something like this : FT.SEARCH idx:tasks "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8}" LIMIT 10 30

Thank you a lot.

Note: I have tried in different ways, Like : redis.call("FT.SEARCH", "idx:tasks", "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8} LIMIT 10 30") which isn't wroking too.


Solution

  • LIMIT, 10, and 30 all need to be discrete arguments. Like this:

    const query = "@labels:{619f668a333141a9d9a078e3 | 619f668a333141a9d9a078c8}"
    redis.call("FT.SEARCH", "idx:tasks", query, "LIMIT", 10, 30)
    

    I moved the query out to a separate value for readability.