I have been trying to use Fql query to show all ments for a post.at first i show 2 posts then when 'show more ments' clicked i show next 50 ments,this way it continues.when 'show more ments' i execute following by ajax call to graph api with -
SELECT text,post_id FROM ment WHERE post_id=post_id limit 50
but say when i first click 'show more ments' it shows 52 ments,then when i click again it shows around 102 ments.but for next clicks 152 ments not shown.its stays in around 102 ments.
my target -
1st click to 'show more ments' = show 52 ments starting from first ments(limit value = 52 i specify in query )
2nd click = show 102 ments starting from first ments(limit value=102)
3rd click = show 152 ments starting from first ments(limit value=152) ......continues
so i am not able to achieve this.I really tried many ways using offset too.lots of problems.Are there facebook bugs? kindly help asap.
I have been trying to use Fql query to show all ments for a post.at first i show 2 posts then when 'show more ments' clicked i show next 50 ments,this way it continues.when 'show more ments' i execute following by ajax call to graph api with -
SELECT text,post_id FROM ment WHERE post_id=post_id limit 50
but say when i first click 'show more ments' it shows 52 ments,then when i click again it shows around 102 ments.but for next clicks 152 ments not shown.its stays in around 102 ments.
my target -
1st click to 'show more ments' = show 52 ments starting from first ments(limit value = 52 i specify in query )
2nd click = show 102 ments starting from first ments(limit value=102)
3rd click = show 152 ments starting from first ments(limit value=152) ......continues
so i am not able to achieve this.I really tried many ways using offset too.lots of problems.Are there facebook bugs? kindly help asap.
Share asked May 1, 2013 at 22:06 dev-mdev-m 4608 silver badges24 bronze badges 1- Also Main thing i want is how do i get 50 ments starting from 50th ment? – dev-m Commented May 1, 2013 at 23:48
1 Answer
Reset to default 5You should try out cursor pagination, it's remended as explained at https://developers.facebook./docs/reference/api/pagination/
Returned results under cursor paging more consistently match the limit requested, even after hiding any records for which you do not have permissions to view (eg. if you request 10 records, but do not have permissions to see 3 of those records, 3 additional records will be pulled transparently, so that a full 10 records are pulled).
Example with post_id_cursor:
SELECT text, post_id, post_id_cursor FROM ment WHERE post_id='22707976849_10151395520781850' ORDER BY time DESC limit 50
You get the post_id_cursor of the last ment, then navigate next page with >post_id_cursor symbol
SELECT text, post_id, post_id_cursor FROM ment WHERE post_id='22707976849_10151395520781850' AND post_id_cursor>'Mjg3NA==' ORDER BY time DESC limit 50
Example with object_id_cursor is same:
SELECT text, post_id, object_id_cursor FROM ment WHERE object_id='10151395520696850' ORDER BY time DESC limit 50
SELECT text, post_id, time, object_id_cursor FROM ment WHERE object_id='10151395520696850' AND object_id_cursor>'Mjg3NA==' ORDER BY time DESC limit 50
Update:
Make sure you enabled "July 2013 Breaking Changes:" field at your app advanced settings, https://developers.facebook./apps/YOUR_APP_ID/advanced. More info at https://developers.facebook./roadmap
Example of get feed for certain user:
https://developers.facebook./tools/explorer?fql=%7B%22query1%22%3A%22SELECT%20post_id%2C%20actor_id%2C%20created_time%2C%20message%20FROM%20stream%20WHERE%20source_id%3D611693239%20AND%20created_time%3C%3Dnow()%20LIMIT%2050%20%22%2C%22query2%22%3A%22SELECT%20post_id%2C%20id%2C%20fromid%2C%20time%2C%20text%2C%20user_likes%2C%20likes%20FROM%20ment%20WHERE%20post_id%20IN%20(SELECT%20post_id%20FROM%20%23query1)%20LIMIT%205%20%22%2C%22query3%22%3A%22SELECT%20id%2C%20name%2C%20pic_square%20FROM%20profile%20WHERE%20id%20IN%20(SELECT%20actor_id%20FROM%20%23query1)%20or%20id%20IN%20(SELECT%20fromid%20FROM%20%23query2)%22%7D%0A