FQL,搜索非朋友人并按共同朋友排序 [英] FQL, search for non-friend people and sort by mutual friends

查看:64
本文介绍了FQL,搜索非朋友人并按共同朋友排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我寻找名称中带有模式的Facebook用户(任何用户,而不仅仅是我的朋友或特定用户的朋友),

I look for facebook users (any user, not just my friends or the friends of a specific user) with a pattern in the name, like this:

SELECT first_name,uid FROM user WHERE contains('pete')

这将返回一组包含"pete"(即"peter")名字的人.这个数字很高,因此结果当然会被截断.我想在这个集合中(在服务器端截断之前)抓住与​​我(或具有任意用户ID)有最多共同朋友的谁.但是,发行

This returns an array of people who's name contains "pete" (i.e. also "peter"). The number is quite high, so the results are of course truncated. I would like to grab, in this set (before the server-side truncation) who has most mutual friends with me (or with an arbitrary user id). However, issuing

SELECT first_name,uid FROM user WHERE contains('pete') AND mutual_friend_count > 1

给出并清空集(并且没有错误).我认为服务器会由于性能原因(或我在文档中错过的明确限制)而在应用后一种选择之前将其截断,就像在普通SQL中那样.

gives and empty set (and no errors). I think the server truncates before applying the latter selection, as in normal SQL would happen, for performance reasons (or explicit limits I missed in the documentation).

我进行了第二次尝试,尝试检索用户ID的所有朋友,然后在名称上进行选择.但是,不允许检索朋友的朋友(从技术上讲,这很困难,因为有些朋友隐藏了他们的朋友列表,这使查询中断了.)

I made a second attempt by trying to retrieve all the friends of friends of a userid, and then select on the name. However, retrieving friends of friends is not allowed (and technically difficult because some friends hide their list of friends, and this breaks the query).

我看不到实现目标的其他方法...有什么吗? (我的意思是:给定一个用户名,搜索拥有最多共同朋友的用户).

I can see no other way to achieve my goal... is there any? (I mean: given a userid, search for users with highest number of mutual friends).

推荐答案

我刚尝试使用由doming_friend_count desc排序",它可以正常工作.因此查询需要为:

I just tried it with "order by mutual_friend_count desc" and it worked. So the query needs to be:

选择first_name,uid从用户WHERE包含('pete')的顺序,由common_friend_count desc

SELECT first_name,uid FROM user WHERE contains('pete') order by mutual_friend_count desc

这篇关于FQL,搜索非朋友人并按共同朋友排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆