我正在使用此查询进行FQL:
SELECT pid, object_id, caption, like_info, comment_info, src, src_small, src_big, images FROM photo WHERE album_object_id="10151088306597851" ORDER BY like_info DESC
但是当我使用带有FB.api()方法的Javascript SDK时,它失败并出现错误604“你的语句不可索引.WHERE子句必须包含一个可索引的列。这些列在从{链接的表中用*标记{3}}” 但根据表格“照片”“album_object_id”的文档IS可索引..
这是我的Javascript代码:
if (album_object_id) {
var query = 'SELECT pid, object_id, caption, like_info, comment_info, src, src_small, src_big, images FROM photo WHERE album_object_id="' + album_object_id + '" ORDER BY like_info DESC';
//console.log(query);return;
FB.api('/fql?q=' + encodeURI(query), callback);
}
当我记录查询并将其复制/粘贴到图形API控制台时,它可以正常工作..
任何线索??
欢呼声 Sjoerd
答案 0 :(得分:3)
我认为encodeURI在此语法上引入了一个查询编码问题。以下代码完美运行并返回82项:
var query = 'SELECT pid, object_id, caption, like_info, comment_info, src, src_small, src_big, images FROM photo WHERE album_object_id="10151088306597851" ORDER BY like_info DESC';
FB.api('/fql', {q: query}, function(r) {
console.log(r)
});
}