有人知道如何按距搜索位置的距离来排序Facebook地点吗?请注意,我不想在客户端应用程序中订购结果.我希望Facebook服务器向我提供有序的结果,以方便分页.我一直想将后续查询中的位置追加到数组的末尾.
Does anyone know how to order Facebook places by distance from a search location? Note that I don't want to order results in my client app. I want the Facebook server to provide me with ordered results to facilitate pagination. I always want to append places from subsequent queries to the end of my array.
使用诸如以下这样的图形API查询似乎无法实现:
This does not seem possible using the graph API query such as:
graph.facebook/search?q=coffee&type=place¢er=37.76,-122.427&distance=1000& ....因为有没有办法告诉Facebook订购结果.最接近的位置可能是返回结果列表中的最后一个.
graph.facebook/search?q=coffee&type=place¢er=37.76,-122.427&distance=1000&.... because there is no way to tell Facebook to order the results. The nearest place may be last in the list of returned results.
我一直在尝试使用FQL复制上述查询,但是名称& Facebook位置表中的描述字段不可索引. FQL,例如:
I have been trying to replicate the above query using FQL but have a problem in that the name & description fields in the Facebook place table are not indexable. FQL such as:
SELECT page_id, name, display_subtext, description, distance(latitude, longitude, "37.76", "-122.427"), checkin_count FROM place WHERE ((distance(latitude, longitude, "37.76", "-122.427") < 25000) AND (strpos(lower(name), "coffee") >= 0 OR strpos(lower(description), "coffee") >= 0)) ORDER BY distance(latitude, longitude, "37.76", "-122.427") ASC LIMIT 20 OFFSET 0问题在于,位置表中的字段name和description不可索引.这意味着并非所有结果都由FQL返回,有很多缺失的结果.
Problem with this is that the fields name and description are not indexable in the place table. This means that not all the results are returned by the FQL, there are many missing results.
推荐答案似乎可以使用此FQL. contains函数似乎与q= Graph API参数相同.这是您使用contains
It seems like it's possible using this FQL. The contains function seems to work the same as the q= Graph API param. Here's your example using contains
SELECT page_id, name, description, latitude, longitude, checkin_count, distance(latitude, longitude, "37.76", "-122.427") FROM place WHERE distance(latitude, longitude, "37.76", "-122.427") < 1000 AND CONTAINS("coffee") ORDER BY distance(latitude, longitude, "37.76", "-122.427") LIMIT 20更多推荐
按距离排序Facebook Places结果
发布评论