【问题标题】:Unexpected behavior when using FQL使用 FQL 时的意外行为
【发布时间】:2012-08-14 21:07:46
【问题描述】:

将 LIMIT 选项添加到 FQL 会导致返回比没有 LIMIT 更多的结果。 举个例子:

SELECT post_id, actor_id, message,description,type FROM stream WHERE source_id = me()

返回 4 个结果:

{ "data": [
{
  "post_id": "1458319848_4164228991531", 
  "actor_id": 1458319848, 
  "message": "Oh happy days!", 
  "description": null, 
  "type": 46
}, 
{
  "post_id": "1458319848_4081409841104", 
  "actor_id": 1458319848, 
  "message": "", 
  "description": "Caroline Natan and Or Karlinsky are now friends.", 
  "type": null
}, 
{
  "post_id": "1458319848_4076275592751", 
  "actor_id": 1458319848, 
  "message": "", 
  "description": "Caroline Natan changed her Interested In.", 
  "type": null
}, 
{
  "post_id": "1458319848_4075703458448", 
  "actor_id": 100001179537125, 
  "message": "", 
  "description": null, 
  "type": 237
}]}

但使用:

SELECT post_id, actor_id, message,description,type FROM stream WHERE source_id = me() LIMIT 9

返回 5 个结果:

{"data": [
{
  "post_id": "1458319848_4164228991531", 
  "actor_id": 1458319848, 
  "message": "Oh happy days!", 
  "description": null, 
  "type": 46
}, 
{
  "post_id": "1458319848_4081409841104", 
  "actor_id": 1458319848, 
  "message": "", 
  "description": "Caroline Natan and Or Karlinsky are now friends.", 
  "type": null
}, 
{
  "post_id": "1458319848_4076275592751", 
  "actor_id": 1458319848, 
  "message": "", 
  "description": "Caroline Natan changed her Interested In.", 
  "type": null
}, 
{
  "post_id": "1458319848_4075703458448", 
  "actor_id": 100001179537125, 
  "message": "", 
  "description": null, 
  "type": 237
}, 
{
  "post_id": "1458319848_4069875152744", 
  "actor_id": 100000876758120, 
  "message": "", 
  "description": null, 
  "type": 237
}]}

当然,这没有任何意义! 我在这里错过了什么吗?如果有,是什么?我也读过this,我没有看到关于这里描述的问题的任何内容。

提前致谢。

【问题讨论】:

    标签: facebook limit facebook-fql


    【解决方案1】:

    您链接到的文章实际上解决了这个问题:

    您可能会注意到返回的结果数并不总是等于指定的“限制”。这是预期的行为。在检查返回的结果是否对查看器可见之前,我们将应用查询参数。因此,您得到的结果可能比预期的要少。

    这基本上意味着 facebook 在执行查询后过滤结果。

    在您的示例中,在第一个查询中,有一个隐式限制,例如 5。在这 5 个结果中,由于可见性限制,1 个被过滤掉,您得到 4 个。 在第二个查询中,服务器得到 10 个结果,根据可见性过滤掉其中的 5 个,然后返回 5 个给您。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-02
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多