The use case is very simple.
Say I have a zSet called "Employee" with values like so
zAdd Employee 1000 "Eric Anderson"
zAdd Employee 1200 "Eric Henderson"
zAdd Employee 1400 "Eric Johnson"
zAdd Employee 1500 "Jackie Johnson"
zAdd Employee 1600 "John Ericson"
So basically, if I wanted to have a function for users of the system to wildcard search for Employees, showing the result ordered by the score (highest to lowest), can I solve that with ZSCAN?
What I would like to do is something like this
ZSCAN Employee MATCH "*ohn*" LIMIT 0, 20
and get a result set like so
John Ericson, 1600
Jackie Johnson, 1500
Eric Johnson, 1400
leaving the other two since they don't match the search phrase "ohn".
In other words, this is BASIC search functionality. One which you could liken to
SELECT * FROM Employee WHERE name LIKE "%ohn%" ORDER BY salary
In the above select, salary is the score value, obviously. The above query with LIKE and % % is obviously not advisable since it will not use index and will thereby filesort.
Please advice.
Edit: I forgot to add a suggested solution where you perform a regular ZSCAN that gets all values matching the search phrase, in whatever order I can't figure out, and then put those in a new zSET and perform a zREVRANGE on it, to get the results, and then remove that zSet. That's what I can think of will actually work, but is it advisable?