FQL你的说法是不转位,但在控制台罚款(FQL Your statement is not inde

2019-10-17 08:31发布

我使用这个查询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 

其作品在控制台罚款,检查: https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20pid%2C%20object_id%2C%20caption%2C%20like_info%2C%20comment_info %2C%20src%2C%20src_small%2C%20src_big%2C%20images%20FROM%20photo%20WHERE%20album_object_id%3D%2210151088306597851%22%20ORDER%20BY%20like_info%20DESC

但是,当我使用JavaScript SDK与FB.api()方法时失败,错误604“你的说法是不编入索引的WHERE子句必须包含一个可索引列这样的列标有从链接表中*。 HTTP:// developers.facebook.com/docs/reference/fql “但根据表的文档‘照片’,‘album_object_id’可转位..

这是我的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

Answer 1:

我认为这是由是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)
    });
}


文章来源: FQL Your statement is not indexable, but fine in console