Facebook API返回Uncaught异常:604:您的声明不可索引


Facebook API returning Uncaught Exception: 604: Your statement is not indexable

我目前正在制作一个应用程序,该应用程序将阅读墙上的一些帖子。问题是我一直得到这个错误

Fatal error: Uncaught Exception: 604: Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql thrown in 'application'libraries'base_facebook.php on line 1238

我已经有了这些权限,我甚至在我的应用程序设置中添加了一些其他权限read_stream offline_access read_insights

AppId、secret和access_token都已设置。

更新:当我将查询更改为这个时,API返回了一个不同的错误

$fql = "SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id = me() AND created_time > 1346277600 LIMIT 50";

更新:我现在得到这个错误

Fatal error: Uncaught Exception: 102: Requires user session thrown in 'application'libraries'base_facebook.php on line 1238

参见:

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

只有少数字段是可索引的,因此其中一个字段应用于FQL的where子句。你的查询对我来说似乎很好。

https://api.facebook.com/method/fql.query?query=SELECT%20post_id%2C%20actor_id%2C%20target_id%2C%20message%20FROM%20stream%20WHERE%20source_id%20%3D%20me%28%29%20AND%20created_time%20%3C%201346647136%20LIMIT%2050&access_token=access_token_HERE

我只是忘了把access_token放在facebook->api调用上

$data['posts'] = $this->facebook->api(array(
                   'method' => 'fql.query',
                   'query' => $fql,
                   'access_token'=>$facebook['access_token']
                 ));