How to filter by category in FQL

2019-04-28 21:25发布

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

3条回答
▲ chillily
2楼-- · 2019-04-28 22:05

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楼-- · 2019-04-28 22:13

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.

查看更多
太酷不给撩
4楼-- · 2019-04-28 22:18

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.

查看更多
登录 后发表回答