Question

I am trying to write a Facebook query that will return all comments posted by a user to his friends,

however I can't seem to find the correct schema. Its as if there are no 'indexable' fields to build this.

Any suggestions please?

With thanks,

Wineshtain

Was it helpful?

Solution

The indirect path for stream comments would be something like

select * from comments where fromid = <my_id> and object_id in (
   select post_id from stream where sourceid in (
       select uid1 from friend where uid2 = <my_id> ) )

for photos, substitute the middle query with

SELECT pid FROM photo WHERE aid IN ( SELECT aid FROM album WHERE owner IN ( ...

Unfortunately the security settings may restrict the querying your friends wall posts and photos.

OTHER TIPS

I don't believe you can accomplish this in a direct manner as you describe. FQL tables are generally only indexed on a limited criteria (for performance reasons I'm sure). In the case of the Comments FQL Table, you can only select comments via a post ID or an xid.

Unfortunately, this means that you have to know the objects that a user has commented on before you can get the comments for it. You would have to have previously selected all the posts, photos, etc. that you wished to get the comments for before you could retrieve them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top