2016-11-10 35 views
0

我有一個使用smartsheet庫函數的node.js腳本。搜索除了不會返回完全匹配外,即使搜索字符串中有幾個與smartsheet匹配的字符,也會返回所有這些行。你如何用精確匹配進行搜索?smartsheet api在搜索過程中的精確匹配

var options = { 
    sheetId: xxxxxxxxxxx, 
    queryParameters: { 
    query: <string to search> 
    } 
}; 

// Search sheet. 
smartsheet.search.searchSheet(options) 
    .then(function (data) { 
    console.log(data); 
} 

所以,如果我用「測試」作爲搜索字符串其返回結果,其中1個或多個字符與像「TES」「測試」是一個匹配,則返回那些行..搜索

回答

1

默認情況下,Smartsheet接受部分匹配 - 無論是在UI還是通過API。 。 要限制完全匹配,在雙引號將搜索詞(「)

使用REST API,你可以嘗試:https://api.smartsheet.com/2.0/search/sheets/xxxxxxxxx?query=%22test%22

或者在節點:

var options = { 
    sheetId: xxxxxxxxxxxx, 
    queryParameters: { 
     query: '"test"' 
    } 
}; 

// Search sheet. 
smartsheet.search.searchSheet(options) 
    .then(function (data) { 
    console.log(data); 
}); 

這是在文章中提到https://help.smartsheet.com/articles/522231-searching-in-smartsheet#items