Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
547 views
in Technique[技术] by (71.8m points)

facebook fql - getting latest photos from friends not working

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...