使用FQL时发生意外行为 [英] Unexpected behavior when using FQL
问题描述
在FQL中添加LIMIT选项会导致返回比没有LIMIT时更多的结果. 例如:
Adding the LIMIT option to an FQL causes MORE results to return than without the LIMIT. For an example:
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
}]}
当然,这没有任何意义! 我在这里想念什么吗?如果是这样,那又如何呢?另外,我已经阅读了此,我没有看到有关此处所述问题的任何信息
Of course this DOESN'T MAKE ANY SENSE! Am I missing something here? if so, what? Also I've read this, I didn't see anything regarding the problem described here.
谢谢.
推荐答案
您链接的文章实际上解决了此问题:
The article you linked to actually addresses this issue:
您可能会注意到,返回的结果数并不总是等于指定的限制".这是预期的行为.在检查返回的结果是否对查看器可见之前,将查询参数应用到我们这一端.因此,您获得的结果可能会少于预期.
You might notice that the number of results returned is not always equal to the "limit" specified. This is expected behavior. Query parameters are applied on our end before checking to see if the results returned are visible to the viewer. Because of this, it is possible that you might get fewer results than expected.
这基本上意味着Facebook在执行查询后会过滤结果.
Which basically means that facebook filters the results after it executes the query.
在您的示例中,在第一个查询中,存在一个隐式限制,即5.在这5个结果中,由于可见性限制而将1过滤掉,结果为4. 在第二个查询中,服务器获得10个结果,并根据可见性过滤掉其中5个,并向您返回5个.
In your example, in the first query, there's an implicit limit, say 5. Out of these 5 results, 1 is filtered out because of visibility restrictions and you get 4. In the second query, the server gets 10 results, filters 5 of them out based on visibility and returns 5 to you.
这篇关于使用FQL时发生意外行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!