调整Foursquare API搜索查询的最佳方法是什么? [英] What's the best way to tune my Foursquare API search queries?

查看:80
本文介绍了调整Foursquare API搜索查询的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Foursquare的场所搜索API中得到了一些不稳定的结果,并且我想知道是否有人对如何为最直观"的结果处理我的输入参数提供任何提示.

I'm getting some erratic results from Foursquare's venue search API and I'm wondering if anyone has any tips on how to process my input parameters for the most "intuitive" results.

例如,假设我要在纽约,纽约"附近搜索一个名为"Ise Sushi"的场所,该场所等效于使用Google Maps API的(lat:40.7143528,lon:-74.00597309999999).插入Foursquare Venue API,我们得到:

For example, suppose I am searching for a venue called "Ise Sushi", around "New York, NY", which is equivalent to (lat: 40.7143528, lon: -74.00597309999999) using Google Maps API. Plugging into the Foursquare Venue API, we get:

https://api.foursquare.com/v2/venues/search?query=ise%20sushi&ll=40.7143528%2C-74.00597309999999

这会产生令人印象深刻的结果:我要寻找的场地最终排在第11位,排在最后.有趣的是,降低坐标的精度似乎会产生更好的结果.例如,假设我们将坐标四舍五入为3个有效数字:

This yields pretty underwhelming results: the venue I'm looking for ends up rather far down the list, at 11th place. What's interesting is that reducing the precision of the coordinates appears to produce much better results. For example, suppose we were to round the coordinates to 3 significant digits:

https://api.foursquare.com/v2/venues/search?query=ise%20sushi&ll=40.7%2C-74.0

这一次,我要寻找的场地最终排在第二位,即使它实际上距离搜索中心更远(1072米,而使用第一个查询的距离为833米) ).

This time, the venue I'm looking for ends up in 2nd place, even though it is actually farther from the center of the search (1072 meters, vs. 833 meters using the first query).

似乎可以帮助提高搜索质量的另一种修改方法是用下划线代替空格以分隔我们的搜索字词.例如,这是带有下划线的原始查询:

Another modification that appears to help improve the quality of search is substituting underscores for spaces to separate our search terms. For example, here's the original query with underscores:

https://api.foursquare.com/v2/venues/search?query=ise_sushi&ll=40.7143528%2C-74.00597309999999

这会产生最直观的结果:我要寻找的地点首先出现,并且仅伴随一个结果,即伊势餐厅"(被标记为寿司餐厅").对于它的价值,这实际上似乎是在Foursquare自己的网站上进行的同一搜索的结果集.

This produces the most intuitive-seeming results: the venue I'm looking for appears first, and is accompanied by just one other result, "Ise Restaurant" (which is tagged as a "sushi restaurant"). For what it's worth, this actually seems to be the result set of the same search conducted on Foursquare's own website.

我很好奇我应该从中学到什么教训.我应该降低坐标的精度吗?我是否应该将我的搜索字词与下划线连接起来,如果这样,那是否会限制用户订购其搜索字词的方式?

I'm curious what lessons I should be learning from this. Should I be reducing the precision of my coordinates? Should I be connecting my search terms with underscores, and if so, does that limit how a user can order their search terms?

推荐答案

尽管我们可以在排名上进行改进以找到这种遥远的精确匹配,但通常也有助于指定intent = browse(尽管看起来像这种情况下,目前可能会给您带来更糟糕的结果).默认情况下,/venues/search使用intent = checkin,它会非常努力地寻找附近的匹配项以进行签入,但会以其他方式使场所与您的搜索相匹配为代价.要了解更多信息,请访问 https://developer.foursquare.com/docs/venues/search

Although there are ranking improvements we can make on our end to find this distant exact match, it generally also helps to specify intent=browse (although it looks like in this case, for now, it may give you worse results). By default, /venues/search uses intent=checkin, which tries really hard to find close-by matches for checking in to, at the expense of other ways a venue might match your search. Learn more at https://developer.foursquare.com/docs/venues/search

这篇关于调整Foursquare API搜索查询的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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