2

I am building a new corpus using Watson Concept-Insights. I've created about 100 documents so far using nodeJS. If I use curl to list the documents, I can find all of them. However when I nodeJS to list the same set of documents, it consistently ignores the limit value and returns the default of 20 documents. Help!!

Essential code follows (account key replaced with 'myAccount'):

 var watson = require('watson-developer-cloud');
 var concept_insights = watson.concept_insights({ yada yada... this all works }

 params = { 'corpus': '/corpora/myAccount/theAdviser', 'limit': 200 };
 concept_insights.corpora.listDocuments(params, function(err,_res) {
    if (err) { console.log(err); }
    else { console.log(JSON.stringify(_res, null, 2)); 
    res.send(JSON.stringify(_res, null, 2)); }
  });

No matter what value is entered for the limit option, I always get 20 results. CURL, on the other hand, returns the full list or a subset based on the specified limit. The equivalent working curl statement is:

 curl -u "{userID}":"{password}" "https://gateway.watsonplatform.net/concept-insights-beta/api/v2/corpora/myAccount/theAdviser/documents?limit=200"
Bob Dill
  • 1,000
  • 5
  • 13

2 Answers2

2

It looks like this was an oversight in the npm module. I just added support for the limit param, it should be released as v1.9.1 once the CI loop finishes.

Nathan Friedly
  • 7,837
  • 3
  • 42
  • 59
-1

Unfortunately, this does not seem to be reproducible for the corpora I have access to. For example, this curl:

curl -s -u username:password \
"https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/public/TEDTalks/documents?limit=100"

Produces a list of 100 documents for me. If you have jq installed you can verify:

curl -s -u username:password \
"https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/public/TEDTalks/documents?limit=100" \
| jq '.[] | length'

100

Another way to try to look at your corpus, is checking the "Concept Insights Dashboard" available in Bluemix by clicking on your service instance tile (the icon that is currently in use by your application). The first page of the dashboard allows you to select the corpus, and it reports a high-level summary of the corpus (including number of documents).