Thursday, April 18, 2013

FQL: query user table by name

I was trying to find Facebook user by querying by name in the user table. According to the Facebook documentation, the name field of user table is indexable. Therefore, logically it is possible to query by name.

But when I query user table by name field, it gives me the error with code 604.

The error message is "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql "

The name field of user table is marked with * in the facebook documentation; https://developers.facebook.com/docs/reference/fql/user/.

----

I have googled about it and found the solution in stackoverflow. It says to run the query on profile table by name and get the id of the user. Then query the user table by the id.

SELECT uid FROM user WHERE uid IN (SELECT id FROM profile WHERE name="kamrul hassan")

Source: http://stackoverflow.com/questions/13793567/fql-filter-user-table-by-name

Wish this will help you.