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