Last active
April 19, 2017 21:04
-
-
Save itamarhaber/f3c82a8553abd8d7750c to your computer and use it in GitHub Desktop.
Redis suffix search function in Lua. Call with key name of search terms set and the argument to search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local res = redis.call("zrangebylex", KEYS[1], "\[" .. ARGV[1]:reverse(), "\[" .. ARGV[1]:reverse() .. "\\xff") | |
for k, v in pairs(res) do | |
res[k] = v:reverse() | |
end | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment