jsindexer is an example javascript view that creates an inverted index needed to do full text search on a CouchApp or CouchDB database hosted on cloudant.com. This is an alternative to the Java/Lucene indexers used by default.
cloudant hosted account (sign up at https://cloudant.com/#!/solutions/cloud), couchapp
cd jsindexer
cat > .couchapprc
{"env":{"default":{"db":"http://<user>:<pass>@<user>.cloudant.com:5984/<db_or_couchapp_you_want_to_search>"}}}
^C
that last line means hit CTRL-C
To configure the indexing of documents, modify the file:
views/whitespace/map.js
Cloudant search expects key,value pairs with the following format:
emit([field,token],[[1,6,8]]);
where 1,6,8 are the positions of that token in the field. The positions enable phrase searches.
couchapp push
Now trigger indexing with:
http://<user>.cloudant.com:5984/<db_or_couchapp_you_want_to_search>/_design/jsindexer/_view/whitespace
Once indexing is done, you can use the regular search syntax (http://support.cloudant.com/kb/search/search-api), but yon need to specify the index:
http://<user>.cloudant.com:5984/<db_or_couchapp_you_want_to_search>/_search?q=myfield:"some phrase"&index=_design/jsindexer/_view/whitespace