问题描述
我目前正在开发一个Android应用程序,使用Facebook的图形API来获取基于用户的位置页/地方。我也想通过分类筛选结果,如餐馆为例。现在我只是在寻找命名为餐厅是这样的:<一href="https://graph.facebook.com/search?q=restaurant&type=place¢er=37.76,-122.427&distance=1000" rel="nofollow">https://graph.facebook.com/search?q=restaurant&type=place¢er=37.76,-122.427&distance=1000
I'm currently developing an Android app that uses Facebook graph API to get pages/places based on user's location. I also want to filter the results by category, like restaurants for example.For now I'm just searching for the name "restaurant" like this:https://graph.facebook.com/search?q=restaurant&type=place¢er=37.76,-122.427&distance=1000
现在的问题是,它不会找到没有名字餐厅的网页/地方,它也返回鸵鸟政策有什么用餐馆的地方。我也有语言问题,在非英语国家我的搜索将完全失败。
The problem is that it wont find pages/places that don't have name "restaurant" and it also returns places that don´t have anything to do with restaurants. I also have the language issue, in non-English countries my search will fail completely.
一个可能的解决方案我正在考虑是要在一个范围内的所有地方,并分析它们在我的应用程序的类别或名称。显然,这带来了很大的开销,以我的应用程序。
A possible solution I am considering is to get all the places in a range and parse them in my app for the category or name. Obviously this brings a lot of overhead to my app.
我在想,如果有喜欢用FQL得到过滤效果更好的解决办法?
I was wondering if there is a better solution like using FQL to get filtered results?
推荐答案
应该有,但我不能解开如何。
There should be, but I can't unravel how.
这FQL查询,将让你对附近的一个已知位置的所有场所的信息:
This FQL query will get you information about all places near a known location:
SELECT name, page_id, categories, description, general_info
FROM page WHERE page_id IN
(SELECT page_id FROM place WHERE
distance(latitude, longitude, "37.76", "-122.427") < 1000
)
在类别
字段与值的数组 ID
和名称
。看着这些结果,有一系列类别的名称,如餐厅的:意大利餐厅,酒吧/餐厅等
The categories
field is an array with the values id
and name
. Looking at these results, there are a series of category names like "Restaurant": "Italian Restaurant", "Bar/Restaurant, etc.
我不能找到一种方法来一个在类别
子句添加到这个返回数据。
What I can't find is a way to add a WHERE categories
clause to this that returns data.
这篇关于按类别Facebook的图形API搜索的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!