Cloudant basics

Find a document by id: I want to look for an design document which name is 'search'. So the id of the document would be '_design/search' Search the document using the primary index with a parameter:
$ curl -u accountame:password 'accountname.cloudant.com/qdef/_all_docs?key="_design/search"&include_docs=true'
{"total_rows":5,"offset":3,"rows":[
{"id":"_design/search","key":"_design/search","value":{"rev":"14-1826c1455da23e06b926e9a29ac9ec63"},"doc":{"_id":"_design/search","_rev":"14-1826c1455da23e06b926e9a29ac9ec63","views":{"names":{"map":"function(doc) {...}"}}}}
]}
Search the document with its id directly:
$ curl -u accountame:password 'accountname.cloudant.com/qdef/_design/search'

{"_id":"_design/search","_rev":"14-1826c1455da23e06b926e9a29ac9ec63","views":{"names":{"map":"function(doc) {...}"}},"language":"javascript","indexes":{"doc":{"analyzer":"standard","index":"function (doc) {...}"}}}

Useful Links

Lucene stuff
http://lucene.apache.org/core/4_3_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Overview
Escaping Lucene Characters using Javascript Regex
http://stackoverflow.com/questions/26431958/escaping-lucene-characters-using-javascript-regex
CouchDB API documentation (Basis of Cloudant)
http://wiki.apache.org/couchdb/HTTP_Document_API
View collation (selecting stuff using views)
http://docs.couchdb.org/en/latest/couchapp/views/collation.html
Cloudant library for nodejs on Github
https://github.com/cloudant/nodejs-cloudant#Cloudantdbgetname-callback
Search with complex keys (this is too advanced for me probably)
https://developer.ibm.com/answers/questions/173495/bluemix-cloudant-nano-how-to-search-on-complex-arr.html
Find documents within a range (me)
https://developer.ibm.com/answers/questions/191004/how-to-search-a-string-whose-value-is-between-2015.html
URL encoder/decoder - Useful tool for working with non ascii strings in below tutorials
http://meyerweb.com/eric/tools/dencoder/

Official IBM Cloudant sites

Cloudant API Documentation. (With very simple examples at the right)
https://docs.cloudant.com/api.html#index-functions
Cloudant.com - Primary Indexes (_all_docs)
https://cloudant.com/for-developers/all_docs/
Cloudant.com - Secondary Indexes (views)
https://cloudant.com/for-developers/views/
Cloudant.com - Search Indexes (Queries)
https://cloudant.com/for-developers/search/
Cloudant.com - Examples. Full Text indexing is quite easy to understand
https://cloudant.com/for-developers/examples/
https://cloudant.com/blog/search-faceting-from-scratch-2/
Cloudant.com - Authentication
https://cloudant.com/for-developers/faq/auth/
Cloudant.com - Introducing Cloudant Query
https://cloudant.com/blog/introducing-cloudant-query/

0 comments :

This work is licensed under BSD Zero Clause License | nacho4d ®