Watson 发现服务 - 查询数据收集Node.js - 段落缺失



>我对 Watson Discovery Service 的响应运行查询,我想在我的响应中包含段落(默认情况下不包含段落,使用段落 = true 应该包括它。但我没有 明白了。

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 参考一样。

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 行中讨论此参数。

注:段落参数仅在私人收藏中受支持。它在 Watson Discovery News 集合中不受支持。不能在同一查询选项中使用natural_language_queryquery参数。

最新更新