vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | for $user in dataset('Users') |
2 | let $similar_users := | ||||
3 | for $similar_user in dataset('Users') | ||||
4 | let $similarity := jaccard_similarity($user.interests, $similar_user.interests) | ||||
5 | where $user != $similar_user | ||||
6 | and $similarity >= .75 | ||||
7 | order by $similarity desc | ||||
8 | limit 10 | ||||
9 | return { "user_name" : $similar_user.name, "similarity" : $similarity } | ||||
10 | return { "user_name" : $user.name, "similar_users" : $similar_users } |