Watson Concept-Insights 文档 list/limit 选项在 nodeJS 中不起作用

Watson Concept-Insights document list/limit option not working in nodeJS

我正在使用 Watson Concept-Insights 构建一个新的语料库。到目前为止,我已经使用 nodeJS 创建了大约 100 个文档。如果我使用 curl 列出文件,我可以找到所有文件。但是,当我用 nodeJS 列出同一组文件时,它始终忽略限制值和 returns 默认的 20 个文件。求助!!

基本代码如下(帐户密钥替换为 '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)); }
  });

无论为限制选项输入什么值,我总是得到 20 个结果。另一方面,CURL returns 完整列表或基于指定限制的子集。 等效的工作 curl 语句是:

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

不幸的是,对于我可以访问的语料库,这似乎无法重现。例如,这个卷曲:

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

为我生成一个包含 100 个文档的列表。如果您安装了 jq,您可以验证:

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 Dashboard"。仪表板的第一页允许您 select 语料库,它报告语料库的高级摘要(包括文档数量)。

看起来这是 npm 模块中的疏忽。我刚刚添加了对 limit 参数的支持,它应该在 CI 循环完成后作为 v1.9.1 发布。