How to filter by category in FQL

2019-04-28 21:49发布

问题:

As you can see here,

Businesses have their category information: Local Business, Sport, Education.. etc. It is the field "category".

I would like to know, is there a way to filter businesses by their category and position with FQL? I haven't found how to do it. For instance: give me all the sports center in this circle (lat, lon, radius).

thanks

回答1:

I have been looking for something and haven't found anything. It appears that only the graph api has the category information for a page.



回答2:

The "category" attribute in the "page" table is called "type". Here is a query to filter the logged-in user's "local business" likes:

SELECT page_id, name, description, type, pic, fan_count
FROM page
WHERE
   page_id IN (SELECT page_id FROM page_fan WHERE uid = me())
   AND Type = 'LOCAL BUSINESS'

Run Example



回答3:

You can't retrieve pages by category.

The FQL Page table has a field called categories.

You can retrieve the category for a business with FQL like this:

SELECT categories FROM page WHERE page_id = PAGE_ID

where PAGE_ID is the page's Facebook id.

However, categories is not an indexable field. You can't ask for all business in New York which are Florists since "WHERE categories = florist" isn't allowed.