FQL没有返回用朋友标记的照片

时间:2012-10-25 10:04:45

标签: facebook facebook-graph-api facebook-javascript-sdk facebook-fql

我正在尝试使用FQL来获取我自己的照片列表,其中有朋友标记在其中。朋友是通过他们的名字或他们的名字的一部分来指定的。即从文本框输入

到目前为止,我已经提出了下面的FQL,它几乎可以工作,但是......

有人能告诉我为什么第一个查询返回记录列表但第二个查询什么都不返回?两者之间的唯一区别是第二个人只搜索一个人名称的一部分,即“laura”vs“lau”

FQL 1

SELECT object_id, src_big, src_big_width, src_big_height, aid 
FROM photo 
WHERE object_id in (
    SELECT object_id
    FROM photo_tag 
    WHERE subject in (
        SELECT uid 
        FROM user 
        WHERE (strpos(lower(name),"laura") >=0 ) 
        AND (uid in (SELECT uid2 FROM friend WHERE uid1 = me()) )) 
)
AND owner = me()

FQL 2

SELECT object_id, src_big, src_big_width, src_big_height, aid 
FROM photo 
WHERE object_id in (
    SELECT object_id
    FROM photo_tag 
    WHERE subject in (
        SELECT uid 
        FROM user 
        WHERE (strpos(lower(name),"lau") >=0 ) 
        AND (uid in (SELECT uid2 FROM friend WHERE uid1 = me()) )) 
)
AND owner = me()

1 个答案:

答案 0 :(得分:1)

看起来Facebook的系统中有bug,因此strpos在子查询中无法正常工作。作为一种解决方法,您可以尝试将其拆分为两个查询 - 一个查找id-s列表:

SELECT uid 
        FROM user 
        WHERE (strpos(lower(name),"lau") >=0 ) 
        AND (uid in (SELECT uid2 FROM friend WHERE uid1 = me()) )

使用此列表的第二个:

SELECT object_id, src_big, src_big_width, src_big_height, aid 
FROM photo 
WHERE object_id in (
    SELECT object_id
    FROM photo_tag 
    WHERE subject in (111,222,333,444,555)
)
AND owner = me()