我对这个FQL查询感到困惑:
SELECT type,attachment,message,permalink,created_time
FROM stream
WHERE
source_id = xxxxxx and
actor_id= xxxxxx and
type = 247
ORDER BY created_time DESC
LIMIT 46
它返回空。但是当我尝试这个时:
SELECT type,attachment,message,permalink,created_time
FROM stream
WHERE
source_id = xxxxxx and
actor_id= xxxxxx and
type = 247
ORDER BY created_time DESC
LIMIT 50
它按照我的预期返回1条记录。
是因为LIMIT
还是别的什么?如何显示用户的15个帖子?
答案 0 :(得分:0)
这是一个Facebook的怪癖:一些帖子被“隐藏”在响应中。所以前45个帖子都是隐藏的(考虑到你用来获取帖子的凭证),接下来的5个中的1个(一个)是可见的。所以它只返回那个可见的。增加限额,你可能会得到更多。
没有真正的解决方法,除了不包括限制,然后手动计数和使用前15。
答案 1 :(得分:0)
List<WallPosts> posts = facebookClient.executeQuery("select strip_tags(message),type from stream where filter_key = 'others'",WallPosts.class);
Iterator<WallPosts> postIterator = posts.iterator();
int wallCount = 0;
while (postIterator.hasNext()) {
if (wallCount == 15) break;
WallPosts post = postIterator.next();
if (post.message != null) { // if message is not blank
wallCount ++;
System.err.println(post.message);
}
将从其他人那里获取经过身份验证的用户墙上的最后15条消息。有些消息是空白的,这就是我进行空检查的原因。