如何在Foursquare Venues搜索API中使用categoryId [英] How to use categoryId in Foursquare Venues search API

查看:122
本文介绍了如何在Foursquare Venues搜索API中使用categoryId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当包含categoryId参数时,我从API查询中得到了意外的结果.

I am getting unexpected results from API queries when including a categoryId parameter.

例如,使用以下参数搜索马萨诸塞州波士顿市的市民旅馆"

For instance, when using the following parameters to search for 'The Citizen Public House' in Boston, MA

ll: 42.3489027315987, -71.096134185791
query: citizen 
categoryId: 4bf58dd8d48988d116941735    <== 'bars' 

最终结果包括其他类别的场所,例如银行". categoryId参数有问题吗? API文档中将其标记为实验性".我使用不当吗?

The results wind up including venues from other categories, like 'banks'. Is there something wrong with the categoryId parameter? In the API documentation it is labeled 'experimental.' Am I using it improperly?

仅供参考:我正在使用quimby gem通过Rails应用程序与foursquare API进行交互.

FYI: I am using the quimby gem to interface with the foursquare API via a rails app.

谢谢!

推荐答案

如果您要寻找的地方是

市民旅馆牡蛎酒吧

Citizen Public House & Oyster Bar

然后您使用了错误的categoryId :(
类别具有层次结构,搜索是通过层次结构完成的.

Then you were using the wrong categoryId :(
The categories have an hierarchy, and search is done by it.

具体来说,4bf58dd8d48988d116941735是酒吧类别
那个地方是威士忌吧,类别ID:4bf58dd8d48988d122941735

Specifically, 4bf58dd8d48988d116941735 is the bars category
That place is a Whisky Bar, category ID: 4bf58dd8d48988d122941735

为什么银行会退回,不确定:)我几乎可以确定,在使用查询进行搜索时,foursquare引擎会强制结果与查询匹配,而不考虑其他过滤器.

Why banks returned, not sure :) I am almost sure that when searching with a query, the foursquare engine forces results to match the query, regardless of other filters.

您应该下载所有类别,并查看类别树以更好地了解要使用哪个ID使用.
请注意,您可以查找夜生活"类别4d4b7105d754a06376d81259 其中包含所有条形图,由于您正在查询,因此您应该找到要查找的内容(也可以尝试使用intent=match或浏览并选择半径).

You should download all categories and see the categories tree to better understand which ID to use.
Note, you can look for the Nightlife category 4d4b7105d754a06376d81259 which have all bars included in it, since you are looking with a query you should find what you are looking for (you can also try experimenting with intent=match or browse and a radius as well).

这篇关于如何在Foursquare Venues搜索API中使用categoryId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆