Facebook FQL使用ORDER BY created_time正确排序流表

时间:2013-07-08 23:40:29

标签: facebook sorting stream facebook-fql posts

按* created_time *排序时,使用FQL检索一系列帖子时遇到了一些麻烦。似乎当我尝试通过* created_time *检索帖子排序时,FQL首先检索由* updated_time *排序的前50个帖子(LIMIT 50),然后在前50个帖子中应用 ORDER BY

每当有人对该帖子发表评论时,* updated_time *日期时间都会更新,因此,如果有人对1年前的帖子发表评论,那么我的第一个查询中的最后一个帖子将是该帖子,我的下一个序列将从该点开始时间(超过1年)。

这导致了一个问题,因为要获得序列中的下50个帖子,我必须使用第一个查询中最后一个帖子的* created_time * datetime。

关于如何正确使用这种方法的任何想法?

SELECT post_id,actor_id,message,created_time,updated_time FROM stream WHERE source_id=xxx AND created_time < xxxxxxxx ORDER BY created_time DESC LIMIT 50


示例:

有一个帖子有时间戳:'updated_time':1372837741和'created_time':1372081023

使用以下查询,虽然帖子的created_time在指定的created_time范围内,但没有结果。

SELECT post_id,actor_id,message,permalink,created_time,updated_time FROM stream WHERE source_id=xxxxxxxxx AND created_time < 1372081033 AND created_time > 1372081013

但如果我更改查询的范围以包含帖子的updated_time,则会返回上面的帖子。

SELECT post_id,actor_id,message,permalink,created_time,updated_time FROM stream WHERE source_id=xxxxxxxxxxx AND created_time < 1372837742 AND created_time > 1372081013

这可能是一个错误。


提前致谢!

0 个答案:

没有答案