Does facebook fql contain the sql like operator?

2020-02-01 02:09发布

I am building a small facebook app. Trying to search for values in an auto compelte manner. Is it possible to use sql's like operator in fql?

3条回答
狗以群分
2楼-- · 2020-02-01 02:53

There is no LIKE operator in FQL.

However, you may have luck with the IN operator:

WHERE "Stanford" IN education_history.name

This page may also help and has sample queries:

查看更多
Lonely孤独者°
3楼-- · 2020-02-01 03:04

I know this thread is long since dead but I'm sure this may help someone in the future. FQL has its uses in some respects, but as far as searching for public information goes, I would recommend using the new graph api. I compared a simple FQL query with a similar graph query and on average, the graph was almost three times as fast (0.3s vs 0.8s). Here is a my graph example using PHP and CURL:

$search = "platform";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/search?q=".$search."&type=page");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$fbPages = json_decode($output)->data;
print_r(array_slice($fbPages, 0, 10));

Hope that helps!

PS: if you are not running PHP version 5.2.0 or above you will need a JSON decoder found here.

EDIT: you can find some useful documentation here.

查看更多
家丑人穷心不美
4楼-- · 2020-02-01 03:13

Another way for you is to use the strpos(message, "content you want") >= 0. I don't know why, but the IN operator does not run for me. Did anyone try it?

查看更多
登录 后发表回答