Talk:FQL
From Facebook Developers Wiki
SELECT name
FROM group
WHERE gid IN ( SELECT gid
FROM group_member
WHERE uid=u03829
AND
gid IN (SELECT gid
FROM group_member
WHERE uid=u03829))
Contents |
[edit] Extending the wiki FQL section?
I'm just looking at other parts of the wiki compared to FQL. There is just about no info here. Any particular reason why? Personally I'd like to put in documentation for FQL syntax and quirks versus other query languages (esp. SQL) and of the data schema (wiki pages for each table). If there are no objections within the next day or so, I am going to go ahead and start putting this in. Dustin Fineout 09:40, 23 November 2007 (PST)
[edit] Difference in results for FQL and Method-API?
Hello,
I have been experimenting with the API Tool. I submit the following FQL query in Test Console mode:
select uid from group_member where gid="7521561140" <--- a real group with many members
In the response, I see only myself as a member of the group:
<?xml version="1.0" encoding="UTF-8"?> <fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
<group_member> <uid>619675476</uid> <--- my own UID for the session under which I am logged in </group_member>
</fql_query_response>
But if I submit an equivalent inquiry via the groups.getMembers API call in the console Test Application mode, with the same GID, with my same login credentials, I see all group members:
<?xml version="1.0" encoding="UTF-8"?> <groups_getMembers_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<members list="true"> <uid>26161</uid> <--- a very long list of real UIDs <uid>206359</uid> <uid>213393</uid> <uid>512700</uid> <uid>700754</uid> <uid>709642</uid> <uid>710402</uid> <uid>710843</uid> <uid>711437</uid> <uid>711573</uid> <uid>711604</uid> <uid>713487</uid> <uid>713880</uid> <uid>714200</uid> <uid>843915</uid> <uid>930371</uid> <uid>1229612</uid> <uid>3501584</uid>
...and so forth, listing over a hundred UIDs.
I assume the Console tool uses the same login credentials for both the FQL and API modes. Why are the results not equivalent between FQL and API queries? If I am allowed to see all user members of a group via the API, why does FQL not return the same list?
[edit] Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Extra content at the end of the document
I am calling a fql_query from FacebookRestClient (any other method works just fine). but it gives me the error above. if i pick it apart, i can see where the error first arises . . . drilling down to lines 375 / 376. this call "post_request" produces this error "HTML tag not supported: "title?". can anyone help?! post response below
p.s. my fql query is taken directly from examples that work, so it's not a syntactical error on my part.
Response: [post response here]
[edit] Text Search Using Fql?
On the official docs page for fql there is a mention "This is particularly useful in WHERE clauses, for example, WHERE "Stanford" IN education_history.name". When I have experimented with this it only brings back results for full/complete string match. For example searching albums names "FROM album WHERE owner IN (uids) AND upper("theName") IN upper(name). I have also tried using strpos(name,"theName") Can someone confirm that there is no way to search within a field for a string? If there is could you example it please. --hjb 10:00, 17 September 2007 (PDT)
- Response: you might also want to try your own hand at the wild card %. WHERE upper(name) LIKE 'theName%' . . . perhaps this would still work in fql. don't see why not.
- I can confirm that LIKE does not work in FQL. Any official reply?--hjb 12:13, 24 September 2007 (PDT)
[edit] photo_tag table speed
I have been doing some testing and results come back from the photo_tags table REALLY slowly. A canvas page must be created in less than 12 seconds (from test also) and searches in the table can take up to 10 of this time! I tried the query:
"SELECT pid FROM photo_tag WHERE created > " . (time() - (60*60*24*2)) . " AND subject IN (" . $_POST['fb_sig_friends'] . ")";
Using php to fill in the blanks. Well I assumes that putting the "created > (2 days ago)" would make the search much faster. But no! It still took up to 10 seconds (sometimes even timing out). This is really hindering my development so could I get clarification that the table is set up correctly and whether there is anything that can be done to speed it up when using "subject IN (friends)". Thanks --hjb 14:23, 23 September 2007 (PDT)
Just to add to this. The same search on the albums table:
"SELECT aid FROM albums WHERE created > " . (time() - (60*60*24*2)) . " AND owner IN (" . $_POST['fb_sig_friends'] . ")";
takes less than half the time. Always less than 5 seconds. I know the table will be much smaller but thats madness.--hjb 14:45, 23 September 2007 (PDT)
[edit] For PHP?
Might want to post somewhere in the FQL documentation exactly how we are supposed to interface with this through PHP... I've been to about 4 pages on FQL now and I still haven't seen an example.
