Hi guys,
I’m relatively new to Redis, and is pretty neat until now - thanks!
As I have a search case, I’ve installed RediSearch, and I cannot find a clear response about the point where I need to find a field that is contained in a given string - a kind of reverse search.
I would appreciate it if someone could tell me if RediSearch supports this scenario.
Now I’m doing this:
...
local cursor = "0"
repeat
local res, err = redis:scan(cursor, "match", "books:*", "count", 1000)
if not res then
ngx.log(ngx.ERR, "failed to hscan: ", err)
break
end
local data
cursor, data = unpack(res)
if next(data) then
-- test the book name key from the index that matches the search query
for key , value in pairs(data) do
-- check if the book name contains the search query
if string.find(query, value, 1, true) then return true end
...
In Elasticsearch I think it is named Percolate query.
Thanks!