Monday, May 14, 2012

Google Places API search refinements, as requested by you

The Google Places API allows web and mobile app developers to search Google’s index of business listings and POI data. Since launching the Places API last year we’ve received a lot of great feedback from developers, in response to which we’ve implemented a number of additional features. Today we are taking a closer look at two of them: keyword search and rank by distance.

Keyword search
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.
Rank by distance
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.
Keyword search and rank by distance are available in both the Places API web service and in the places library of the JavaScript Maps API v3. You can try these new features using the map below. Enter any keywords into the text field, and optionally filter over business types using the drop down menu on the right. You can also switch to ranking by distance, in which case the places closest to the center of the map (indicated by the red map pin) will be returned:



These new features are a direct result of feedback from Places API developers. If you would like to help us improve the Places API further, please submit ideas for new features using the Maps API Issue Tracker. For assistance using these features, or any other aspect of the Places API, you can find us on Stack Overflow.