问题是由于每个 FQL 查询的默认 LIMIT 值 (LIMIT 100)。
首先SELECT uid2 FROM friend WHERE uid1=me()查询运行并输出你的 100 个朋友
其次,SELECT aid FROM album WHERE owner IN (..100 Friends...)查询运行并输出 100 个朋友的 s100 个相册。
最后 SELECT pid, caption,aid, owner, link, src_big, src_small, created, modified, like_info FROM photo WHERE created > 1325356200 and aid IN (...100 Aid...) ORDER BY like_info.like_count DESC LIMIT 30次查询运行并输出 100 个专辑的结果。
显然结果根本不是你想要的。您可能会尝试自己增加限制(例如 LIMIT 1000),但它对我从来没有用过。获得准确结果的唯一方法是尝试图形 API,但执行起来需要很长时间,最终它是一个死的选择。
我的答案的证明
尝试运行这些代码
SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified, like_info
FROM photo WHERE created > 1325356200 and aid IN (SELECT aid FROM album WHERE owner IN
(SELECT uid2 FROM friend WHERE uid1=me() order by rand() ))ORDER BY like_info DESC LIMIT 30
我使用 rand() 函数来随机化朋友
SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified, like_info FROM
photo WHERE created > 1325356200 and aid IN (SELECT aid FROM album WHERE owner IN (SELECT
uid2 FROM friend WHERE uid1=me() ) order by rand() ) ORDER BY like_info DESC LIMIT 30
在这里,我使用 rand() 来随机化专辑。您可以尝试随机化这两个查询。每次你执行这些代码时,它会给出非常不同的结果,你会注意到有更多的图片和更多的喜欢。