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.
We understand that many web sites know that all of their users are located in a single country. For example if a U.S. based online retailer ships only to U.S. addresses, there is no need for Autocomplete to offer completions for addresses outside of the U.S. We have therefore launched country filtering, which allows you to constrain the completions to a specific country.
We also recognise that many applications prompt users to enter a location that is not as fine grained as an exact street address. I you are booking a hotel or browsing for real estate you are often prompted to enter the city or zipcode you are interested in. To address this need we have introduced additional type filters that allow you to limit completions to only cities, or to only coarse grained features such as zipcodes, states, and countries.
Give us feedback in our Product Forums.