Reputation: 1680
I am using FQL to run a query for FB Likes, but the pagination seems to be working strange. the first query runs to grab up to 400 like_urls as follows:
SELECT url from url_like where user_id='FB_USER_ID' LIMIT 0, 400
it returns in this example a list of about 25 urls. The problem is that i have this looped in case they have more than 400. inside this loop the query may run again as follows:
SELECT url from url_like where user_id='FB_USER_ID' LIMIT 25, 400
The result is the same 25 URLs ... shouldn't the limit 25,400 ignore the first 25 per FQL? the mechanism that I use to break my loop is if the returned results totals 0, so this is currently putting my query into a loop and it just times out.
Any pointers or info about how FDB FQL limiting works, or why the LIMIT isn't working right for the like_url would be appreciated.
Examples of the first 5 iterations for a current query I have (showing even inconsistent numbers in the result though the URL list appears the same)
02-26-2014 08:03:33 - **** Running pass 1 to get likes for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Likes pass 1 URL Query: SELECT url from url_like where user_id=FB_USER_ID ORDER BY url ASC LIMIT 0, 400 ****
02-26-2014 08:03:33 - **** pass 1 had 25 URLs for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Running pass 2 to get likes for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Likes pass 2 URL Query: SELECT url from url_like where user_id=FB_USER_ID ORDER BY url ASC LIMIT 25, 400 ****
02-26-2014 08:03:33 - **** pass 2 had 22 URLs for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Running pass 3 to get likes for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Likes pass 3 URL Query: SELECT url from url_like where user_id=FB_USER_ID ORDER BY url ASC LIMIT 47, 400 ****
02-26-2014 08:03:33 - **** pass 3 had 20 URLs for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Running pass 4 to get likes for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Likes pass 4 URL Query: SELECT url from url_like where user_id=FB_USER_ID ORDER BY url ASC LIMIT 67, 400 ****
02-26-2014 08:03:33 - **** pass 4 had 19 URLs for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Running pass 5 to get likes for FB UID FB_USER_ID ****
02-26-2014 08:03:33 - **** Likes pass 5 URL Query: SELECT url from url_like where user_id=FB_USER_ID ORDER BY url ASC LIMIT 86, 400 ****
02-26-2014 08:03:33 - **** pass 5 had 19 URLs for FB UID FB_USER_ID ****
Upvotes: 0
Views: 93
Reputation: 3396
FQL shows you only url that you can see.. for example, i have 10 likes, but the first 3 are hidden for some reason:
[0] Hidden
[1] Hidden
[2] Hidden
[3] Public
[4] Public
...
[9] Public
This FQL query
SELECT url from url_like where user_id='FB_USER_ID' LIMIT 0, 10
will return only 7 records (publics).. the same will happend with
SELECT url from url_like where user_id='FB_USER_ID' LIMIT 3, 10
or
SELECT url from url_like where user_id='FB_USER_ID' LIMIT 100
The solution is to count all the likes so you know how many records you must expect... but Facebook FQL doesn't implement the 'count' function.
So there isn't a real solution for this problem afaik
Upvotes: 1