I want to show top 5 users on logged user dashboard based on following criteria:
users are opting following attributes in their profile:
Relationship preferences,
Hobbies,
Interests,
Language etc
More the preferences will match, highest priority to user's profile will be assigned
table_users
userid ufname ulname gender
--------------------------------
1 test1 Test2 M
2 testF TestF F
3 testF1 TestF1 F
4 testF2 TestF2 F
5 testF5 TestF2 F
table_preferences
preference_id user_preferences
--------------------------------
1 Cooking
2 Gardening
3 Smoking
4 Single
5 widow
6 traveling
table_user_preferences
userid user_preference_id
--------------------------------
1 1
1 2
1 3
1 4
2 3
2 4
3 2
3 3
3 6
4 1
5 1
5 2
5 3
5 4
5 6
Now, suppose user one is logged in, on his dashboard other registered users (with opposite i.e. gender female) will get display whose highest attributes are matching. As we can see, user five 5 matches most of the attributes so it will be display on top of list and rest will be get display accordingly as follows:
Result required:
User_id ufname
5 testF5
3 testF1
2 testF
4 testF2
My Query is I am thinking to use relevance search. Will it be suitable. Anyone can help me any suggestions.