I am developing a social networking website, and in this website I am giving friend suggesstion, friend list, mutual friends list (between logged in user and another user). I am doing all this very well in SQL. I have following tables in MS SQL 2008.
- CountryMaster (CountryID (Pk), CountryName)
- StateMaster (StateID (Pk), StateName, CountryID (Fk->CountryMaster.CountryID))
- CityMaster (CityID (Pk), CityName, StateID (Fk->StateMaster.StateID) )
- UserMaster (UserID (Pk), UserName, FName, LName, Email, BirthDate, CityID (Fk->CityMaster.CityID))
- UserFriends (TableID (Pk), UserID (Fk->UserMaster.UserID), FriendID (Fk->UserMaster.UserID), Status (eg. 1.Accepted,2.Pending) )
Now in redis I have created a hash for UserMst like
hset **UserMst:id hash**
example = hset UserMst:1 [UserID:1, UserName:ryan, FName:ryan, LName:Briones, Email:ryan@somedomain.com, BirthDate:1984-05-31, CityID:548]
I have created a set for logged in user's friend list. sadd "FriendList:id array
example = sadd "FriendList:1 [548,4785,6589,214587]"
Another set I have created for logged in users.
sadd "LogginUsers" 1
Now I want friend suggestion, which give me a users list which is not in my contact list but it exists in my friend's contact list, and order should show first the maximum mutual count, then citywise (logged in user's city)
I have read documents, posts, blogs. But I can not understand how can I do this... I think I have to use it out of box, but I don't know how. If someone can guide me, I will definitely reach the solution.