IBM Cloudant Tutorials

Using a Search Index

Cloudant's search is built upon Lucene and allows you to do more ad hoc queries over your data than can be done with primary and secondary indexes. If you learn better by seeing a demonstration, watch these videos first:


If you do not already have the IBM Cloudant service provisioned in Bluemix, follow these steps to provision the service. ▼More

Replicate the sample database

You'll be working with a sample database in this tutorial. Follow these steps to replicate the sample datatabase. ▼More

Review Index functions

Search indexes are defined by a javascript function. This is run over all of your documents, in a similar manner to a view's map function, and defines the fields that your search can query. ▼More

Query a search index

Search indexes are defined by a javascript function. This is run over all of your documents, in a similar manner to a view's map function, and defines the fields that your search can query. ▼More

Review the Index Options

The built-in index function takes three arguments; the Lucene field, the value for that field and an optional options object. ▼More

Review Analyzers

The built-in index function takes three arguments; the Lucene field, the value for that field and an optional options object. ▼More

Per-Field Analyzer

Sometimes a single analyzer isn't enough. You can use the perfield analyzer to configure different analyzers for different field names. ▼More

API options

As you probably noticed above, the search URL requires a q (or query) query string. This is the query that is passed on to the search index. There are two data types supported by search; string and number. The data type is auto detected. If you need to pass a number in as a string you will need to quote it, e.g. q="12". ▼More

Review Query Syntax

The Cloudant search query syntax is based on the Lucene syntax. ▼More

Example applications

To demonstrate the functionality of search we've pulled together a couple of example applications. ▼More

Find more videos and tutorials in the Learning Center.