Cloudant search

Sometimes you just need to query your data using a search engine. Cloudant Search is built upon Lucene and allows you to build custom search indexes of your documents.

See search in action!

Search over geo data

Cloudant search lets you run dynamic queries against your views and data. For this example we've hooked search up to the SimpleGeo "Places of Interest" dataset. While Cloudant search isn't suitable for high precision geo searches (that's being improved on in search v2.0) it's good enough for some basic uses, such as this example.

The table below is populated with 10 places within a 5 mile bounding box of your location (as determined by MaxMind). This uses a range query for the search:

lat:[LAT1 TO LAT2] AND lon:[LONG1 TO LONG2]

This query is run against an index generated with the following index function:

  if (doc.geometry){
    index('lat', doc.geometry.coordinates[1], {"store":"yes"});
    index('lon', doc.geometry.coordinates[0], {"store":"yes"});

About the example

This example uses the Creative Commons licenced SimpleGeo "places of interest" dataset. This is a directory of business listings and contains NN locations from MM countries. Your definition of "interest" may vary...

The example uses the MaxMind geoip API and code from to determine distances between locations.