When searching for business it’s often the case that you have very fine grained requirements. You don’t just want a restaurant, you want a Mexican restaurant. You don’t just want a clothes shop, you want a vintage clothes shop. You don’t just a want a bar, you want a bar that offers live music.
The Google Places API offers filtering over 100 different types, including restaurant, clothing_store, and bar. As rich as this type scheme is, it can not cover the infinite range of fine grained requirements that you or your users might have.
For these situations the Places API now offers keyword search, which searches places based on an arbitrary text string. Results are matched against all the information that Google has about a business, including country specific categories, cuisine, and Google review content.
Keyword searches can also be combined with type filters. For example, you could add a type filter of ‘bar’ to a keyword search for ‘wine’ to ensure your search results include only drinking establishments, and not wine merchants.
By default, the Google Places API orders the search results it returns using the same ranking algorithm as Google Maps, which prioritises places that are popular or prominent. This is great for local discovery and check-in apps, as these are the places likely to be the most interesting or relevant. However for certain types of search, such as gas stations or atms, the closest result is usually preferable.
To help with these use case the Places API can now rank results strictly by distance. In order to rank results by distance you must use some form of query or filter on the search. This can be a name filter, a type filter, or a keyword search. When results are ranked by distance it is not necessary to provide a search radius as the Places API will try to return the 20 closest results within reasonable distance.
Give us feedback in our Product Forums.