Search API is now Generally Available
Surfacing Google technology to developers everywhere is one of our goals with Cloud Platform. The Search API does exactly this. With just a few lines of code, you can use Google Search technology to index and query millions of documents that contain structured data. Today, we’re making the Search API Generally Available so any developer can dive in and get started.
To understand how easy it is to get going with the API, let’s say you were a real estate company that wanted to add search capabilities. To do so, we’ll first import the Search library, and add some listings (referred to generically as Documents in the Search world).
from google.appengine.api import search
listingLocation = search.GeoPoint(37.78, -122.39)
listing = search.Document(
fields=[
search.TextField(name='description', value='Great condo in the city'),
search.NumberField(name='bedrooms', value=2),
search.GeoField(name='location', value=listingLocation)
# omitting the other fields for this example
])
Next we add the newly created listing to our index using the
put()
method.try:
index = search.Index(name='listingsForSale')
index.put(listing)
except search.Error:
logging.exception('Make sure you handle this error')
After we’ve added documents to an index, we’ll grab an index and specify our search query.
index = search.Index(name='listingsForSale')
# search for listings within 8050 meters (~5 miles) of the 94109 zip code
query_string = 'distance(location, geopoint(37.7929, -122.4212)) < 8050'
Finally we’ll perform the search and iterate over the results.
try:
results = index.search(query_string)
# Iterate over the documents in the results
for scored_document in results:
pass # handle results
except search.Error:
logging.exception('...and this one too')
And that’s just a small example. The Search API allows developers to:
- index Atom, Text, HTML, Number, Date, Geopoint fields
- perform queries across all field types, including geospatial queries, partial text matching
- score and sort results
We have many customers using the Search API for a variety of use cases. Key Ingredient, for example, uses the Search API to allow users to perform searches over the 1.6 million recipes in their database. Harlan Beverly, their CEO, said, “Our users are often shocked and delighted by the speed of our search results and our site overall.”
By moving to GA, the Search API is fully supported and comes with a monthly 99.95% SLA. For more information, be sure to check out our docs (Python and Java).
Improvements to the PHP runtime
The Cloud Platform team focuses a lot on providing great developer tools so that you can be as agile as possible in development. In this release, we’ve packaged a PHP interpreter binary in the Windows and Macintosh SDKs, including integration with the App Engine launcher, so that you no longer need to install PHP yourself.
We also believe modularized applications are the right way to go for architecting solutions in the cloud. So the PHP runtime now supports App Engine modules – the ability to split out large-scale applications into logical components that are able to share stateful services and communicate securely.
Finally, we’ve added the Logs API to the PHP runtime, which provides you access to the application and and request logs for your application.
That’s a lot of PHP goodness in 1.8.5, and we’re accepting more users, so sign up to give it a try.
Eclipse Tooling
We took your feedback that our Google Plugin for Eclipse should fully support Cloud Endpoints in the Eclipse standard Web Tools Platform and Java EAR files which are familiar to many Java developers as the most common pattern used in Eclipse for on-premise and cloud environments. Now, check out how to add an App Engine backend to your Android or iOS mobile app.
The complete list of features and bug fixes for 1.8.5 can be found in our release notes. For App Engine coding questions and answers check us out on Stack Overflow, and for general discussion and feedback, find us on our Google Group.
-Posted by Chris Ramsdale, Product Manager
0 comments:
Post a Comment