Skip to content

Commit c42ba82

Browse files
committed
Merge pull request #102 from DanCunnington/issue_66_dynamic_cluster_name
cluster name passed into msg.payload and debug removed in setup function
2 parents 0789f83 + 32fd6c3 commit c42ba82

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

services/retrieve_and_rank/v1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
<script type="text/x-red" data-help-name="watson-retrieve-rank-create-cluster">
8080
<p>The IBM Watson™ Retrieve and Rank service combines two information retrieval components in a single service: the power of Apache Solr and a sophisticated machine learning capability. This combination provides users with more relevant results by automatically reranking them by using these machine learning algorithms.</p>
81-
<p>The create cluster node provisions a Solr cluster. You can specify the <b>size</b> of the cluster in the node configuration panel. For a small free cluster for testing choose the Free option. For more information about cluster sizing, see <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/retrieve-rank/solr_ops.shtml#sizing">Sizing your Retrieve and Rank cluster</a>. A <b>cluster name</b> can also be specified in the node configuration panel.</p>
81+
<p>The create cluster node provisions a Solr cluster. You can specify the <b>size</b> of the cluster in the node configuration panel. For a small free cluster for testing choose the Free option. For more information about cluster sizing, see <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/retrieve-rank/solr_ops.shtml#sizing">Sizing your Retrieve and Rank cluster</a>. A <b>cluster name</b> can be specified in the node configuration panel or passed in on <code>msg.payload</code>. The cluster name specified in the node configuration panel takes priority.</p>
8282
<p>The cluster will then be created. This takes a short while to complete. When the cluster is available, the status underneath the node will change to <b>“Cluster available”</b>.</p>
8383
<p>For more information about the Retrieve and Rank service, read the <a href="https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/retrieve-rank.html">documentation</a>.</p>
8484
</script>

services/retrieve_and_rank/v1.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,12 @@ module.exports = function (RED) {
155155
this.on('input', function(msg) {
156156
setupRankRetrieveNode(msg, config, this, function (retrieve_and_rank) {
157157

158+
//Cluster name can be passed into msg.payload, but the cluster name
159+
//specified in the config takes priority
160+
var clustername;
161+
(config.clustername !== '') ? clustername = config.clustername : clustername = msg.payload;
158162
var params = {
159-
cluster_name: config.clustername,
163+
cluster_name: clustername,
160164
cluster_size: config.clustersize !== 'free' ? config.clustersize : null,
161165
}
162166

@@ -480,7 +484,6 @@ module.exports = function (RED) {
480484

481485
//Check credentials
482486
this.credentials = RED.nodes.getNode(config.servicecreds);
483-
console.log(config);
484487
username = username || this.credentials.username;
485488
password = password || this.credentials.password;
486489

0 commit comments

Comments
 (0)