CategoryId in venues search not working correctly - api

In foursquare Api documentation for "Search venues" https://developer.foursquare.com/docs/venues/search it states
"categoryId - A comma separated list of categories to limit results to. This is an experimental feature and subject to change or may be unavailable. If you specify categoryId you may also specify a radius. If specifying a top-level category, all sub-categories will also match the query."
Realise its supposed to be experimental, but when I provide Food category i.e. 4d4b7105d754a06374d81259, it only returns a few local results, the rest are miles away. However if I execute same search on website sing Food category, it returns correctly lots of results, assuming its the last bit "If specifying a top-level category, all sub-categories will also match the query" is not working , i.e. its not searching sub-categories ?
Any fix work around for this ?
Thanks,
Neil Pepper

You're making a /venues/search request with its default intent of intent=checkin. This returns a filter on nearby results, heavily biased by distance since it's trying to guess where the user might be checking in.
Foursquare Explore uses the /venues/explore endpoint and attempts to return recommended results for a query. If you want to get the sorts of results you get in that tool, call /venues/explore?section=food

Related

foursquare:venues/search?intent=browse returns more places when specifying categoryIds one by one than without categoryId

I use the venues/search endpoint of Foursquare to fetch all places around a point, within a given radius.
For example, if I query without specifying any categoryId:
https://api.foursquare.com/v2/venues/search?ll=48.857091635218225,2.341747995157864&radius=200&v=20151023&intent=browse
I get 11 places. If I additionally specify a categoryId (Food):
https://api.foursquare.com/v2/venues/search?ll=48.857091635218225,2.341747995157864&radius=200&v=20151023&intent=browse&categoryId=4d4b7105d754a06374d81259
I get 23 places, all strictly located within the required radius. How can you get more Food places than places of any category?
I've made more general checks, and this seems to be a general behaviour of the API.
Is this an expected behavior? Any way to have an exhaustive list of places without having to query category by category?

Sorting the response from the Foursquare Places API re:two word name?

We are trying to query the Foursquare api to query for a two word name:
Cava Grill in Gaithersburg, MD
We are trying this via:
https://api.foursquare.com/v2/venues/search?intent=checkin&query=cava%20grill&near=gaithersburg,%20md&limit=1&oauth_token=SEB14NBLGO4HMFTOXQX0JZTSVGM41ENNKE0X1RXHCI5XP3P5&v=20150420
(don't worry ... this is the public API key from the FS page)
Two odd behaviors:
Even though we are explicitly searching for the Cava Grill in Gaithersburg, MD ... the Bethesda, MD one comes up first in the results (odd, why??)
Chipotle Mexican Grill shows up in this result set ... we suppose because of the word "Grill"
So ...
a. anyone know why the Bethesda one would show up higher in the result set? (Should we just narrow the radius tighter?)
b. anyone know if we can look for the "entire query" vs. each word in the query?
Results are queried and sorted differently based on your intent. If you're looking for a specific venue, I suggest changing your intent from checkin to match. Browse may also be a good choice depending on future search params
Here's the nutshell on the intents:
intent=checkin returns a list of venues where the user is most likely is located
intent=browse returns a list of most relevant venues for a requested region, not biased by distance from a central point.
intent=match returns a single result that, with high confidence, is the corresponding foursquare venue for the query-based request
I hope this helps

Foursquare: Search for "Uncategorized" venues

I'm trying to research some data about foursquare usage in my city, for which I need to compile a list of all the venues. The most reasonable way seems to be, to poll for venues in a ne,sw area by category and splitting it up in smaller ones, if I get 50 venues per category (which is the response limit).
Thing is, there are some venues with the category set to "Uncategorized". E.g. https://foursquare.com/v/fonzi/4e20f6af45dd950bb020b1c1
How can I poll for those? Setting categoryId to Null, "" or "Uncategorized" didn't work.
I hope you can help :)
P.S. When doing a venues/search with intent: "browse", do you also get venues which are outside your limits, if the area is very small? It appears so to me, but I might be doing something wrong.
There's no way to filter your query to just uncategorized venues. Sorry!

Venue Search API Inaccurate Using "Near" Instead of "LL"

When I search venues via API I get different results than the foursquare website. For example I'm looking for a venue named "Nopalito" near "San Francisco, CA". I'm under the impression this should return relevant matches:
https://api.foursquare.com/v2/venues/search?query=Nopalito&intent=match&near=San%20Francisco%2C%20CA
I only receive one result for a venue named "Invocation". However, when I run a similar query via foursquare.com website I get what I'd expect:
https://foursquare.com/search?tab=venueResults&q=Nopalito&lat=&lng=&near=San+Francisco%2Cca&source=q
The website search yields two venues named Nopalito in San Francisco, CA.
Seems like a very basic query with a limited number of potential results. What's up? Am I missing something obvious here?
At first glance I'd suggest dropping intent=match, intent=match makes a very restrictive query. The purpose of intent=match (from https://developer.foursquare.com/docs/venues/search ) is to
"Finds venues that are are nearly-exact matches for the given query and ll. This is helpful when trying to correlate an existing place database with foursquare's. It is highly sensitive to the provided location. The results will be sorted best match first, taking distance and spelling mistakes/variations into account."
I'd recommend intent=browse for this type of query.

Flickr Geo queries not returning any data

I cannot get the Flickr API to return any data for lat/lon queries.
view-source:http://api.flickr.com/services/rest/?method=flickr.photos.search&media=photo&api_key=KEY_HERE&has_geo=1&extras=geo&bbox=0,0,180,90
This should return something, anything. Doesn't work if I use lat/lng either. I can get some photos returned if I lookup a place_id first and then use that in the query, except then all the photos returned are from anywhere and not the place id
Eg,
http://api.flickr.com/services/rest/?method=flickr.photos.search&media=photo&api_key=KEY_HERE&placeId=8iTLPoGcB5yNDA19yw
I deleted out my key obviously, replace with yours to test.
Any help appreciated, I am going mad over this.
I believe that the Flickr API won't return any results if you don't put additional search terms in your query. If I recall from the documentation, this is treated as an unbounded search. Here is a quote from the documentation:
Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches" for queries without a geo component.
A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters — If no limiting factor is passed we return only photos added in the last 12 hours (though we may extend the limit in the future).
My app uses the same kind of geo searching so what I do is put in an additional search term of the minimum date taken, like so:
http://api.flickr.com/services/rest/?method=flickr.photos.search&media=photo&api_key=KEY_HERE&has_geo=1&extras=geo&bbox=0,0,180,90&min_taken_date=2005-01-01 00:00:00
Oh, and don't forget to sign your request and fill in the api_sig field. My experience is that the geo based searches don't behave consistently unless you attach your api_key and sign your search. For example, I would sometimes get search results and then later with the same search get no images when I didn't sign my query.