I run a query to the a response from Watson Discovery Service and I would like to include the passages in my response (by default the passages are not include, using passages = true should include it. But I don't get it.
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
}
Can somebody help?
In this case you need to set the passages inside the queryoptions parameter, like this API reference for test seems.
var queryOptions = {'natural_language_query':searchString, 'passages': true};
Try to see the cURL example using this parameter:
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"
This part of Official documentation talking about this parameter in line #663.
Note: The passages parameter is supported only on private collections. It is not supported in the Watson Discovery News collection. You cannot use natural_language_query
and the query
parameter in the same query options .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.