Phạm Quốc Bảo
Phạm Quốc Bảo

Reputation: 894

Cloudant: Query search index with 2 parameters

I wan to call the API with 2 parameters: provider_id and id, but I don't know the structure to call. It's clear how to do it with 1 parameter. Could you give me advice for this? Thanks.

This is the structure to call API with 1 param.

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

Upvotes: 0

Views: 467

Answers (1)

Bernardo Baumblatt
Bernardo Baumblatt

Reputation: 404

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

Upvotes: 1

Related Questions