9
I have users as Redis Hashes and want to find similar users (given a particular user) based on salary and age.
<user>
<id>101</id>
<name>Neo</name>
<age>30</age>
<salary>300</salary>
....
</user>
So, in this case I need to find users who are close to my age AND salary close to my salary both within some given limits. In SQL, I would hypothetically do something like
SELECT id, abs(age - 30) as agediff, abs(salary - 300) as saldiff FROM
USERS WHERE
(age BETWEEN 25 35) AND (salary BETWEEN 250 350) ORDER BY agediff ASC, saldiff ASC
Can we do this, say using ZINTERSTORE, in such a way that the resulting set is ordered by user similarity like in the SQL?