2017-08-10 193 views
1

我對Watson Discovery服務的響應運行查詢,並且希望在響應中包含這些段落(默認情況下,段落不包含,使用段落=真應該包括它。但我不 得到它。Watson Discovery服務 - 查詢數據收集Node.js - 通道丟失

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 

        } 

有人能幫忙嗎?

回答

0

在這種情況下,你需要設置queryoptions參數裏面的通道,像測試這個API參考似乎。

var queryOptions = {'natural_language_query':searchString, 'passages': true}; 

嘗試使用此參數可以看到捲曲例如:

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" 

正式文件,這part在行#663談論這個parameter

注意:只有在專用集合上才支持段落參數。它在Watson Discovery新聞收藏中不受支持。您不能在相同的查詢選項中使用natural_language_queryquery參數。