FQL query through category_list

只愿长相守 提交于 2019-12-04 21:43:50
Stéphane Bruckert

What you are looking for is included in the type field. You wrote TYPE and that is wrong.

type (string): The type of Page. e.g. Product/Service, Computers/Technology

You would need to do:

SELECT page_id, type, categories
FROM page
WHERE page_id IN
  (SELECT
     page_id,
     latitude,
     longitude
   FROM place
   WHERE distance(latitude, longitude, '-30.03852', '-51.17877') < 50000
   LIMIT 100)
AND type="RESTAURANT/CAFE"

... gives you restaurants only:

"data": [
{
  "page_id": 202457279801080, 
  "type": "RESTAURANT/CAFE", 
  "categories": [
    {
      "id": 185459711490789, 
      "name": "Brazilian Restaurant"
    }, 
    {
      "id": 168976549819329, 
      "name": "French Restaurant"
    }, 
    {
      "id": 163300367054197, 
      "name": "Seafood Restaurant"
    }
  ]
}, 

Problem is that in many cases, the type field isn't set by page owners... so you are going to pass by entries which are restaurants:

"data": [
{
  "page_id": 216824565018619, 
  "type": "LOCAL BUSINESS", 
  "categories": [
    {
      "id": 134501539950711, 
      "name": "Sushi Restaurant"
    }
  ]
}

I don't even know where these categories come from and how to set them. In my opinion, this field was used before and is now deprecated. Facebook kept the field so that every page keeps displaying this information.

According to this post, you can't filter categories through an FQL query.

I suggest you to request all the places around using your actual request and to make your own filtering by checking:

  • whether one of the categories contains keywords related to restaurants: restaurant, bar, steakhouse, etc.,
  • OR the type of the place is a RESTAURANT/CAFE.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!