Installing an Example Search API Application

Amy Unruh, Oct 2012
Google Developer Relations


In this lesson we'll install a sample Product Search application. This helps you check that you are set up to successfully develop and deploy an App Engine application, and gives you a platform for experimentation with the Search API throughout this course.


  • Confirm that you are set up to build and deploy App Engine applications
  • Install a sample Product Search application


Introducing the sample application

Our sample program is a product search application. On initialization, it builds a product document index from sample product data and a second index from sample store location data. The store location documents include geopoint (latitude and longitude) information.

The application displays the products and allows users to rate products by submitting reviews. It supports full-text search over the indexed product information, using either simple term-based queries or more complex query syntax. The search results can be sorted in various ways, including by the product's average rating and by a term-frequency relevance metric. Search results use the Search API's snippeting feature to display salient document field substrings. The application also demonstrates the use of search offsets and limits to support pagination.

An example product search
Figure 1: An example product search.

The screen shot above shows a typical search results page. The user has searched for items in the "books" category, and the query is:

(stories OR novel) price > 20

giving a hint of the query language supported by the Search API. This particular query is more complex than we'd expect the average user to input, but we've built our example application so that we can experiment with the query syntax. You'll notice that the matched results show description snippets with search terms in bold, and that we've sorted the search results by product rating.

Showing off the Search API's Geosearch capabilities, users can also search for store locations near them, as shown below:

Using Geosearch to find stores near the user
Figure 2: Using Geosearch to find stores near the user.

The Geosearch form is accessed when viewing the details for a product. Geosearch is currently supported only for deployed applications. The application also shows how to delete documents, create new documents, and perform batch indexing and reindexing of the product data.

Installing and running the example application

To install the example application, first ensure that Python and the App Engine SDK are properly installed, and that you understand the basics of launching and deploying an application. The Quickstart and the Guestbook tutorial will walk you through this process. Then download the example application. You can do a read-only checkout of the App Engine search code samples like this:

% git clone git://

Follow the instructions in the included README file to run the application in the Development Web Server (

After the application is running, initialize its sample data. As described in the README file, this entails logging in as an administrator and clicking the Admin/Add sample data link in the sidebar, followed by the Delete all datastore and index product data, then load in sample product data link. The Development Web Server doesn't currently support all features of the Search API (like Geosearch), so you'll eventually want to deploy the application to You might first need to create an application ID for it.

After you deploy the application and initialize its data, test it by typing a few simple test queries into the search box. For example, try:

(stories OR novel) price < 10

You can also click the Search button without inputting any query constraints, and page through all the sample products in the small data set. You'll find the sample data in the application's data directory. If you want, you can try changing some of the fields and then reinitializing.

Summary and review

In this lesson, you've installed a sample Product Search App Engine application that uses the Search API. In upcoming lessons, you'll be able to use the application's code as a source of concrete examples and experimentation, and play with the Search API's query syntax via its search interface. In the next lesson, we'll start by looking at the basics of the Search API.

Send feedback about...

App Engine standard environment for Python