Does facebook fql contain the sql like operator?

只谈情不闲聊 提交于 2019-11-26 21:27:05

问题


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?


回答1:


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:

  • FQL



回答2:


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?




回答3:


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.



来源:https://stackoverflow.com/questions/1648285/does-facebook-fql-contain-the-sql-like-operator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!