I am trying to build an FQL query that returns post_id's from a specific user to a Facebook group's stream. I can query all posts and iterate through them and pull out what I need, but for a group with a lot of posts, it's not feasible.

The FQL docs lead me to believe I need to use a filter_key in the WHERE clause because actor_id is not indexable. I can't figure out how to use filter_key to get the results I am looking for.

SELECT post_id FROM stream WHERE target_id='a group_id' AND actor_id='a fb_id'

1 Answer
1

SELECT post_id FROM stream WHERE source_id=GROUP_ID and actor_id=USER_ID

For this, since you're looking for posts in a group, the GROUP_ID is your source_id. That is an indexable field. Once you have one indexable field in your WHERE clause, you can add additonal fields to it without a problem.

Also, since GROUP_ID and USER_ID are integers, they don't need to be quoted in FQL.

Thank you! I did try it before but thought it wasn't working because it doesn't pull all(nearly any, really) of the posts from the group feed, even when I specify created_time to pull posts from months ago to the present.
–
Mike JacksonAug 18 '12 at 3:01