How could I use FQL to query all the events without using indexable column which is marked * - facebook

I have a problem to solve.
I want to query all the events and I want to find the specific string.
The FQL code is like the following:
SELECT eid, name, location, start_time, end_time FROM event WHERE strpos(lower(location),'test') >=0
When I used this FQL code,it always occurred error.
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"
Please,give me your point of views~thank you :)

Well, the error message is clear:
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
So simply your approach won't work.
EDIT:
To further explain why this is not possible:
Facebook deals with "over than 900 million objects that people interact with (pages, groups, events and community pages)". reference.
So basically giving you (all App devs) the ability to search ALL pages, events, groups...etc will definitely bring the system down. This is why these "indexible" fields are selected carefully.
For instance, if you want to search events by "location" then these events should be "somehow" related to your application. Like created by your App for example, and you should have their ids stored somewhere so that something like this would work:
SELECT eid, name, location, start_time, end_time FROM event WHERE
strpos(lower(location),'test') >=0 AND eid IN (ids_from_your_db)

Related

Search facebook group using the name as a search term on Facebook FQL

I've tried using the Facebook Graph API. But the results came out, it did not show up to 150 groups. I'm not sure that it is a limitation of Facebook or not.
An example URL that I tested.
Now, I would like to test the FQL Query. But did not succeed. I have the following error
(#604) 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
This is a SQL statement
SELECT gid, name, privacy FROM group WHERE strpos(name, "programming") >= 0

Facebook Graph API Get All Events For Latitude and Longitude

I'm trying to get All public events for given location. Here is what I'm using now
SELECT+name,+pic_cover,start_time,+end_time,+location,+description,venue++FROM+event+WHERE+eid++in(SELECT+eid+FROM+event_member+WHERE+uid+IN+(SELECT+page_id+FROM+place+WHERE+distance(latitude,+longitude,+"40.1811",+"44.5136")+<+50000+limit+0,15000))+ORDER+BY+start_time+desc+limit+0,1500
But there are huge count of events with that location which didn't returning with that FQL query.
Is there any chance to get all events for given location or it may be by City ?
I'm using Python , but if you have some example code on any language please write it out.
I think if you omit the subquery for the event_member table, you'll eventually get more results. Please consider that the results will only include Events created by the Page itself, not those created by individual users.
SELECT name, pic_cover,start_time, end_time, location, description,venue FROM event WHERE creator IN (SELECT page_id FROM place WHERE distance(latitude, longitude, "40.1811", "44.5136") < 50000 limit 0,15000) and start_time > now() ORDER BY start_time desc limit 0,1500
If you have a list of venues of interest, you could use the method I described here: Facebook FQL find all events that take place at a certain venue
Edit 2017-12-20:
As it is now impossible to use FQL if the app was created after 2014-04-30, a direct search is no longer possible. To achieve that, a three-step approach must be used, as implemented in https://github.com/tobilg/facebook-events-by-location-core for example.

FQL like operator

Can someone tell me why this works:
SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) AND strpos(lower(name),"jo") >=0
however this does not:
"SELECT url, id, type, site FROM object_url WHERE strpos(lower(url), 'sephora') >= 0"
When I put it in http://developers.facebook.com/docs/reference/rest/fql.query/
I get this response:
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
however "url" in indeed indexable.
any thoughts? I've already scoured stackoverflow but no answers found.
Site isn't indexable, it's only selectable. It doesn't have an * next to it here https://developers.facebook.com/docs/reference/fql/object_url/
you need to use url or id as the indexable column, so basically one of those needs to be in your where clause.
FQL != SQL You can't a a WHERE on any column you want. Not surprising considering the performance required with so many concurrent writers, I mean, one person in every ten in the world has signed up.
The problem in the second example is that a field used as a parameter in one of the string functions loses its indexability. It has to be the column itself.

Facebook FQL Query, searching on non-indexable item

I would like to generate a list of facebook user id's of people who are not in the United States. Rather than iterating through a list of user id's and checking each locale, I would like to do an FQL query. I attempted to execute this statement:
SELECT uid, name FROM user WHERE locale != "en_US"
However, when I make the query, I recieve the response:
(code 604): Your statement is not indexable.
This is because locale is not an indexable field. Do any of you know what I can do to get around this? Or perhaps another way of doing this entirely?
Thanks in advance!
It says "Your statement is not indexable." That means, you can't just use any query (like, extreme case, SELECT uid, name FROM user to get all facebook users) that does not conform. Only queries that include WHERE on fields that are indexable can be used. It's a policy, you can not circumvent it.

Get a list of events owned by a facebook page

Does anyone know how I can get a list of events owned (created) by a Facebook page?
I seem to be able to use the "graph api" to generate a list of the events an entity is attending. I also looked at FQL, but it seems to require that the 'where' clause is an indexable field (and, naturally, the id is the only indexable field).
For bonus points, we'd be able to do this without any authentication. (Though I'm resigned to the fact that I'm likely going to need at least a permanent access_token.)
If anyone knows how to do this I'd be eternally grateful.
All FQL data access requires authentication, so forget about those "bonus points".
This is going to require some post-query handling as, like you said, the FQL WHERE clause only respects indexible fields and the owner.id field is not indexible. Thus, we first begin by identifying events the user is a "member" of and loading the owner information for those events.
SELECT id, name, owner.id FROM event WHERE id IN (SELECT eid FROM event_member WHERE uid = XXX)
Once the query returns a dataset, we must manually check for rows in which owner.id is equal to uid.
Looks like you have to first query the event_member table, using the uid
http://developers.facebook.com/docs/reference/fql/event_member
and then once you got the eid of the events you can query the events table where the eid is indexed
http://developers.facebook.com/docs/reference/fql/event
and I'm sure you can use the first as a subquery of the second query like var query = FB.Data.query("select name from event where eid in (select eid from event_member where uid = {0})", user_id);
This one does it
select eid from event where creator=".$facebookPageId." and eid in (select eid from event_member where uid=".$facebookPageId.") ORDER BY start_time DESC
This link has a good tutorial on FB events and many more on C#.
http://blog.impact-works.com/2011/07/
But he uses a dll which he created. But as soon as you get the idea out of the blog, you can use Facebook c# Sdk to develop whatever you want to develop.
And all these info is valid for you IFF you are developing in c# my friend.
use this get request
https://graph.facebook.com/'your facebook page ID'/events?access_token=' your application token'&limit='number of events wanted'&after=1&fields=owner,name,description,cover,id
first you must create a facebook application and get its "app token"
In the fileds column you can specify the details you want about the event using the names in facebook API https://developers.facebook.com/docs/graph-api/reference/event/