Method: query.sources.list
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
傳回使用者可用於 Search 和 Suggest API 的來源清單。
注意:執行這個 API 需要標準使用者帳戶。服務帳戶無法直接執行查詢 API 要求。如要使用服務帳戶執行查詢,請設定 Google Workspace 全網域委派權限。
HTTP 要求
GET https://cloudsearch.googleapis.com/v1/query/sources
這個網址使用 gRPC 轉碼語法。
查詢參數
參數 |
requestOptions |
object (RequestOptions )
請求選項,例如搜尋應用程式和使用者時區。
|
pageToken |
string
回應中要傳回的來源數量。
|
回應主體
列出來源回應。
如果成功,回應主體會含有以下結構的資料:
JSON 表示法 |
{
"sources": [
{
object (QuerySource )
}
],
"nextPageToken": string
} |
欄位 |
sources[] |
object (QuerySource )
|
nextPageToken |
string
|
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/cloud_search.query
https://www.googleapis.com/auth/cloud_search
詳情請參閱授權指南。
QuerySource
JSON 表示法 |
{
"source": {
object (Source )
},
"shortName": string,
"displayName": string,
"operators": [
{
object (QueryOperator )
}
]
} |
欄位 |
source |
object (Source )
來源名稱
|
shortName |
string
來源的簡稱或別名。這個值可與「source」運算子搭配使用。
|
displayName |
string
資料來源的顯示名稱。
|
operators[] |
object (QueryOperator )
此來源適用的所有運算子清單。
|
QueryOperator
可在 Search/query.suggest 要求中使用的運算子定義。
JSON 表示法 |
{
"operatorName": string,
"lessThanOperatorName": string,
"greaterThanOperatorName": string,
"type": enum (QueryOperator.Type ),
"displayName": string,
"isSortable": boolean,
"isFacetable": boolean,
"isReturnable": boolean,
"isRepeatable": boolean,
"isSuggestable": boolean,
"enumValues": [
string
],
"objectType": string
} |
欄位 |
operatorName |
string
運算子的名稱。
|
lessThanOperatorName |
string
表示可用於使用小於運算子隔離屬性的運算子名稱。
|
greaterThanOperatorName |
string
表示可用於使用大於運算子隔離屬性的運算子名稱。
|
type |
enum (QueryOperator.Type )
運算子的類型。
|
displayName |
string
運算子的顯示名稱
|
isSortable |
boolean
這個運算子可用於排序結果嗎?
|
isFacetable |
boolean
這個運算子可用於取得切面嗎?
|
isReturnable |
boolean
是否會將與此面向傳回的屬性納入搜尋結果。
|
isRepeatable |
boolean
指出是否可以為此屬性設定多個值。
|
isSuggestable |
boolean
可以取得此欄位的建議。
|
enumValues[] |
string
運算子欄位的可能值清單。只有在我們可以安全地列舉此運算子的所有可能值時,才會填入這個欄位。
|
objectType |
string
對應至運算子的物件名稱。這個欄位只會填入特定結構定義運算子的值,不會填入一般運算子的值。
|
QueryOperator.Type
列舉 |
UNKNOWN |
無效的值。 |
INTEGER |
|
DOUBLE |
|
TIMESTAMP |
|
BOOLEAN |
|
ENUM |
|
DATE |
|
TEXT |
|
HTML |
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Method: query.sources.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListQuerySourcesResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [QuerySource](#QuerySource)\n - [JSON representation](#QuerySource.SCHEMA_REPRESENTATION)\n- [QueryOperator](#QueryOperator)\n - [JSON representation](#QueryOperator.SCHEMA_REPRESENTATION)\n- [QueryOperator.Type](#QueryOperator.Type)\n- [Try it!](#try-it)\n\nReturns list of sources that user can use for Search and Suggest APIs.\n\n**Note:** This API requires a standard end user account to execute. A service account can't perform query API requests directly; to use a service account to perform queries, set up [Google Workspace domain-wide delegation of authority](https://developers.google.com/workspace/cloud-search/docs/guides/delegation/).\n\n### HTTP request\n\n`GET https://cloudsearch.googleapis.com/v1/query/sources`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestOptions` | `object (`[RequestOptions](/workspace/cloud-search/docs/reference/rest/v1/RequestOptions)`)` Request options, such as the search application and user timezone. |\n| `pageToken` | `string` Number of sources to return in the response. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nList sources response.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"sources\": [ { object (/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QuerySource) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------|\n| `sources[]` | `object (`[QuerySource](/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QuerySource)`)` |\n| `nextPageToken` | `string` |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud_search.query`\n- `https://www.googleapis.com/auth/cloud_search`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nQuerySource\n-----------\n\nList of sources that the user can search using the query API.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"source\": { object (/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source) }, \"shortName\": string, \"displayName\": string, \"operators\": [ { object (/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QueryOperator) } ] } ``` |\n\n| Fields ||\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `source` | `object (`[Source](/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source)`)` The name of the source |\n| `shortName` | `string` A short name or alias for the source. This value can be used with the 'source' operator. |\n| `displayName` | `string` Display name of the data source. |\n| `operators[]` | `object (`[QueryOperator](/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QueryOperator)`)` List of all operators applicable for this source. |\n\nQueryOperator\n-------------\n\nThe definition of a operator that can be used in a Search/query.suggest request.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"operatorName\": string, \"lessThanOperatorName\": string, \"greaterThanOperatorName\": string, \"type\": enum (/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QueryOperator.Type), \"displayName\": string, \"isSortable\": boolean, \"isFacetable\": boolean, \"isReturnable\": boolean, \"isRepeatable\": boolean, \"isSuggestable\": boolean, \"enumValues\": [ string ], \"objectType\": string } ``` |\n\n| Fields ||\n|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `operatorName` | `string` The name of the operator. |\n| `lessThanOperatorName` | `string` Indicates the operator name that can be used to isolate the property using the less-than operator. |\n| `greaterThanOperatorName` | `string` Indicates the operator name that can be used to isolate the property using the greater-than operator. |\n| `type` | `enum (`[QueryOperator.Type](/workspace/cloud-search/docs/reference/rest/v1/query.sources/list#QueryOperator.Type)`)` The type of the operator. |\n| `displayName` | `string` Display name of the operator |\n| `isSortable` | `boolean` Can this operator be used to sort results. |\n| `isFacetable` | `boolean` Can this operator be used to get facets. |\n| `isReturnable` | `boolean` Will the property associated with this facet be returned as part of search results. |\n| `isRepeatable` | `boolean` Indicates if multiple values can be set for this property. |\n| `isSuggestable` | `boolean` Can get suggestions for this field. |\n| `enumValues[]` | `string` Potential list of values for the opeatror field. This field is only filled when we can safely enumerate all the possible values of this operator. |\n| `objectType` | `string` The name of the object corresponding to the operator. This field is only filled for schema-specific operators, and is unset for common operators. |\n\nQueryOperator.Type\n------------------\n\nThe type of the property referred by the operator.\n\n| Enums ||\n|-------------|----------------|\n| `UNKNOWN` | Invalid value. |\n| `INTEGER` | |\n| `DOUBLE` | |\n| `TIMESTAMP` | |\n| `BOOLEAN` | |\n| `ENUM` | |\n| `DATE` | |\n| `TEXT` | |\n| `HTML` | |"]]