As a beginner, I would like to know if there is a way to write below query in redis
Scan 0 MATCH Test:[keyword*:* | *:keyword]
Right now I have to do two separate scans for this query as below
Scan 0 MATCH Test:*:keyword*
Scan 0 MATCH Test:keyword*:*
I see that you've 3 choices here:
Wrap both commands into a Lua script and call it as it would be a single command.
Instead of scanning do indexing. Create a set or sorted set where you'll store all elements that matches these patterns, and just perform a a sscan or zscan with no MATCH
.
Keep doing it as you've done already.