Facebook FQL Searching Pages Using Partial String - facebook-fql

I'm trying to search for a company's different branches using a partial string. Here's the query I'm using:
SELECT name, location, fan_count, talking_about_count, were_here_count
FROM page WHERE strpos(name, "Applebee's") >= 0 OR (name < 0)
I get the error:
Your statement is not indexable. The WHERE clause must contain an
indexable column.
Name is listed as indexable, so I'm not sure why this error is occurring.

You can use function CONTAINS():
SELECT name, location, fan_count, talking_about_count, were_here_count FROM page WHERE CONTAINS("Applebee's") and strpos(name, "Applebee's") >=0
This query will output all results which will contain Applebee's in name.

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

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.

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

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)

How to retrieve page ids based on type using FQL?

I want to retrieve page ids of all those pages whose type is Musician/Band. I tried to retrive it from page table as
SELECT page_id from page where type='MUSICIAN/BAND'
but it is not allowing that.Its giving error:
Your statement is not indexable. The WHERE clause must contain an indexable column.
How to go about this?
You simply cannot do that query. You need to include at least one of the indexable columns in your query (page_id or name).