开发者

FQL to search newsfeed

开发者 https://www.devze.com 2023-02-08 03:51 出处:网络
I am having a strange issue with an app that I am developing. I am using PHP SDK to call the Graph API on server side and here is my code that calls the API:

I am having a strange issue with an app that I am developing. I am using PHP SDK to call the Graph API on server side and here is my code that calls the API:

$params = array('q' => 'George', 'limit' => 100);

$newsfeed = $facebook->api('/me/h开发者_Python百科ome', 'GET', $params);

And next is the code to render HTML of the newsfeed. I have a footer below that once clicked, loads further posts. But what I have observed is that in case of searching the newsfeed by providing additional 'q' parameter, we do not get results beyond one week.

Now I am giving a second try to FQL instead of Graph API. Good thing with Graph API was that appending a q parameter to /me/home would do the searching for you automatically and you had nothing to do. But with FQL, this does not seems to be the case as per the following documentation suggests:

http://developers.facebook.com/docs/reference/fql/stream/

My idea is to use following FQL:

SELECT post_id, actor_id, target_id, message, comments, likes FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = me() AND type = 'newsfeed') AND strpos(message, 'facebook') >= 0

Any ideas how the search can be implemented? I actually want to emulate the news feed within the application so please enlighten me about batching multiple FQL queries if you have any ideas on that.


try to set the source_id = me() like this:

SELECT post_id, actor_id, target_id, message, comments, likes 
FROM stream 
WHERE source_id = me()
AND strpos(message, 'facebook') >= 0
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号