Watson Concept-Insights文档列表/限制选项在nodeJS中不起作用

我正在使用Watson Concept-Insights构build一个新的语料库。 到目前为止,我使用nodeJS创build了大约100个文档。 如果我使用curl来列出文件,我可以find所有的文件。 但是,当我在nodeJS中列出同一组文档时,它始终忽略限制值并返回20个文档的默认值。 帮帮我!!

下面的基本代码(帐户密钥replace为“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)); } }); 

无论限制选项input什么值,我总是得到20个结果。 另一方面,CURL根据指定的限制返回完整列表或子集。 等价的工作curl声明是:

  curl -u "{userID}":"{password}" "https://gateway.watsonplatform.net/concept-insights-beta/api/v2/corpora/myAccount/theAdviser/documents?limit=200" 

看起来这是npm模块中的一个疏忽。 我刚刚添加了对极限参数的支持,一旦CI循环结束,它应该被释放为v1.9.1

不幸的是,这对我所访问的语料库来说似乎没有可重现性。 例如,这个curl:

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

为我生成一个100个文件的列表。 如果你安装了jq你可以validation:

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

尝试查看您的语料库的另一种方法是通过单击您的服务实例磁贴(您的应用程序当前正在使用的图标)来检查Bluemix中提供的“Concept Insights仪表板”。 仪表板的第一页允许您select语料库,并报告语料库的高级摘要(包括文档数量)。

Interesting Posts