getting latest photos from friends not working

2019-01-20 07:14发布

I tried getting the latest photos fo my friends using a method described here: FQL - Can i get photos of my friends posted this week

At first it seemed to be working fine but then I noticed that some of the photos of my friends weren't being fetched even though they had a higher timestamp (the photos were being sorted by created field from photo FQL table)... After a bit of debugging I noticed that the problem is in

SELECT aid FROM album WHERE owner IN 
  (SELECT uid2 FROM friend WHERE uid1=me()

if I pass a short list of my friends' IDs they are being sorted correctly, but when I pass a complete list not all friends are included in the query result...

Any ideas why this isn't working? Are there any limits on how many values can be passed in a "SELECT XXX FROM YYY WHERE ZZZ IN (?)" query?

Thanks in advance for any advice

1条回答
等我变得足够好
2楼-- · 2019-01-20 07:24

The limit seems to be about 5000 records returned in any part of an FQL query.

Assuming you have fewer than 5000 friends, you could cut down on the number of albums returned by modifying your query to inspect the modified_major column to only return albums that have had a photo added in the period of interest. You could alternately look at the modified column to return any album modifications.

Also, it looks like aid and pid are on the path to deprecation. New development should use object_id for maximum compatibility.

So to get all albums that have had a photo updated since 2012-10-01, you could use this query:

SELECT object_id FROM album WHERE owner IN 
  (SELECT uid2 FROM friend WHERE uid1=me()) AND modified_major > 1349049600

In your outter query change aid to album_object_id and pid to object_id

查看更多
登录 后发表回答