buyingyi | 2fd7fa6 | 2014-11-24 19:31:55 -0800 | [diff] [blame] | 1 | from $user in dataset('Users') |
2 | with $similar_users := | ||||
3 | from $similar_user in dataset('Users') | ||||
4 | with $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 | select { "user_name" : $similar_user.name, "similarity" : $similarity } | ||||
10 | select { "user_name" : $user.name, "similar_users" : $similar_users } |