Skip to content

Commit d168e72

Browse files
committed
Merge branch 'master' into develop
* master: bump version stringify sort option for search index bump version fix bug when using external service bump version * support search index parameters * add "all documents" option * accept cloudant search index params in payload * send cloudant results in message object update credential access for node-red v0.10 initial migration to cloudant package
2 parents d4ca94e + d6d2356 commit d168e72

File tree

3 files changed

+191
-121
lines changed

3 files changed

+191
-121
lines changed

77-cloudant-cf.html

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
</div>
2323

2424
<div class="form-row">
25-
<label for="node-config-input-user"><i class="fa fa-user"></i> Username</label>
26-
<input type="text" id="node-config-input-user">
25+
<label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
26+
<input type="text" id="node-config-input-username">
2727
</div>
2828

2929
<div class="form-row">
@@ -52,8 +52,8 @@
5252
},
5353
oneditprepare: function() {
5454
$.getJSON("cloudant/"+this.id, function(data) {
55-
if (data.user) {
56-
$("#node-config-input-user").val(data.user);
55+
if (data.username) {
56+
$("#node-config-input-username").val(data.username);
5757
}
5858
if (data.hasPassword) {
5959
$("#node-config-input-pass").val("__PWRD__");
@@ -63,10 +63,10 @@
6363
});
6464
},
6565
oneditsave: function() {
66-
var newUser = $("#node-config-input-user").val();
66+
var newUser = $("#node-config-input-username").val();
6767
var newPass = $("#node-config-input-pass").val();
6868
var credentials = {};
69-
credentials.user = newUser;
69+
credentials.username = newUser;
7070
if (newPass != "__PWRD__") {
7171
credentials.password = newPass;
7272
}
@@ -161,6 +161,7 @@
161161
<select id="node-input-search">
162162
<option value="_id_">_id</option>
163163
<option value="_idx_">search index</option>
164+
<option value="_all_">all documents</option>
164165
</select>
165166
</div>
166167

@@ -318,19 +319,34 @@
318319
A node for searching documents in a Cloudant database.
319320
</p>
320321
<p>
321-
Searching for a document can be done in two modes: directly by using the
322-
document's <b>_id</b> or by using an existing <a
322+
Searching for documents can be done in three modes: directly by using the
323+
document's <b>_id</b>, by using an existing <a
323324
href="https://cloudant.com/for-developers/search/" target="_blank">Search
324-
Index</a>.
325+
Index</a> or retrieving <b>all documents</b> stored in your database.
325326
</p>
326327
<p>
327-
When querying using the <b>_id</b> option, the value for <code>_id</code>
328-
should be passed in the <code>msg.payload</code> as a string.
328+
When querying using the <b>_id</b> option, the value for the document's
329+
<code>_id</code> should be passed in the <code>msg.payload</code> as a
330+
string.
329331
</p>
330332
<p>
331-
To use an existing <b>Search Index</b> stored on the desired database, the
332-
query argument should be passed on the <code>msg.payload</code> following
333-
the <code>indexName:value</code> pattern. <i>The index must be created
334-
beforehand on the database.</i>
333+
To use an existing <b>Search Index</b> stored on the desired database,
334+
the query argument should be passed on the <code>msg.payload</code> as a
335+
string following the <code>indexName:value</code> pattern. Keep in mind
336+
that <i>the index must be created beforehand in the database.</i> and
337+
referenced here by its <code>design document/index name</code>.
338+
</p>
339+
<p>
340+
When querying using a <b>Search Index</b> you can pass the search
341+
parameters as an object in <code>msg.payload</code>. For example, you
342+
can pass an object like this: <code>{ query: "abc*", limit: 100 }</code>
343+
to change the value of <code>limit</code>. You can find more information
344+
on the accepted parameters in the <a
345+
href="https://docs.cloudant.com/api.html?http#queries" target="_blank">
346+
official Cloudant documentation</a>.
347+
</p>
348+
<p>
349+
The last method to retrieve documents is to simply get all of them by
350+
selecting the option <b>all documents</b>.
335351
</p>
336352
</script>

0 commit comments

Comments
 (0)