沃森发现服务 – 查询数据收集Node.js – 通道缺失
我对Watson发现服务的响应运行一个查询,我想在我的回应中包括这些段落(默认情况下,段落不包括,使用段落=真应该包括它,但我不明白。
var queryString = {'natural_language_query':searchString}; insert(cloudantDb,"9", "Call freie Textsuche ", queryString, "-", params); return new Promise ((resolve, reject) => { discovery.query({ environment_id: 'my env id', collection_id: 'my coll id', query: queryString, passages: true, count: 3 }
有人可以帮忙吗?
在这种情况下,您需要在queryoptions参数中设置通道,就像这个API的test参考一样。
var queryOptions = {'natural_language_query':searchString, 'passages': true};
尝试使用此参数查看cURL示例:
curl -u "{username}":"{password}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/{environment_id}/collections/{collection_id}/query?version=2017-06-25&natural_language_query='collie'&passages=true"
这部分官方文档在#663行中讨论了这个参数 。
注意:只有私人collections才支持这些参数。 它在Watson Discovery新闻collections中不受支持。 您不能在相同的查询选项中使用natural_language_query
和query
参数。