FQL流不返回限制所定义的帖子数 [英] FQL stream doesn't return the number of posts as defined by limit

查看:73
本文介绍了FQL流不返回限制所定义的帖子数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了"SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() LIMIT 100",它返回了81个而不是100个帖子,然后我尝试了"SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() LIMIT 50",并且由于第一个查询返回了81个,期望它返回了50个帖子,但是结果仅包含43个帖子.

I tried "SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() LIMIT 100", which returns me 81 instead of 100 posts, then I tried "SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() LIMIT 50", and expecting it returns 50 posts since the first query returns 81, but the result only contains 43 post.

想知道LIMIT的工作原理.

Wondering how LIMIT work.

此外,created_time不适用于我, "SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() AND created_time > 1262196000 LIMIT 100"返回81个帖子,而"SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() AND created_time > 1262196000"仅返回5个帖子.

Besides, the created_time doesn't really works for me, "SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() AND created_time > 1262196000 LIMIT 100" returns 81 posts, while "SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() AND created_time > 1262196000" returns only 5. Any idea?

推荐答案

是的,这很正常. Facebook执行您的FQL,并返回与您的查询匹配的所有帖子.在这种情况下,有100个帖子.

Yes, that is normal. Facebook executes your FQL and returns all posts that match your query. In this case, with 100 posts.

然后 Facebook过滤掉您的应用不可见的帖子.这基于演员的隐私设置. stream表中没有任何visible_to_me字段,可让您预先过滤结果.

Then Facebook filters out the posts that are not visible to your app. This is based on the actor's privacy settings. There is no visible_to_me field in the stream table that would allow you to pre-filter your results.

如果您想要100条帖子,请要求200条,然后显示前100条.大多数情况下,结果中至少会获得100条帖子.

If you want 100 posts, ask for 200, then display the first 100. Most of the time, you'll get at least 100 posts in the result.

如果查询的stream不带LIMIT,则最多可以获取最近50篇文章或最近30天的项目,以较少的为准..

If you query stream without a LIMIT, you will get up to the last 50 posts or the last 30 days worth of items, whichever is fewer.

作为奖励,对于created_time查询,如果您不考虑UNIX时间戳(我不认为),则可以使用strtotime()在FQL中创建时间戳.它解析与PHP strtotime()函数相同的字符串.

As a bonus, for your created_time queries, you can use strtotime() to create timestamps in FQL if you don't think in UNIX time stamps (I don't). It parses the same strings as the PHP strtotime() function.

这篇关于FQL流不返回限制所定义的帖子数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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