Phạm Quốc Bảo Phạm Quốc Bảo - 15 days ago 6
Node.js Question

Cloudant : Query search index with 2 paramters

I wan to call the API with 2 parameters: provider_id and id, but i don't know the structure to call. About 1 parameter, it's well. Could you give me advise for this? Thanks

this is structure to call API with 1 param.

db.search('allstaff', 'allstaff_index', {q:"provider_id:"+request.params.provider_id}, function(err, doc) {

Answer

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

The available logical operators are: AND, +, OR, NOT and -, and are case sensitive.

Your query will looks like

"provider_id:"+request.params.provider_id+" AND id:"+request.params.id

You can read more about in this tutorial.

Or watching this video

Best regards

Bernardo Baumblatt

Comments