Method: query.sources.list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回用户可用于 Search and 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
opeatror 字段的可能值列表。只有在我们能够安全地枚举此运算符的所有可能值时,才会填充此字段。
|
objectType |
string
与运算符对应的对象的名称。此字段仅针对特定于架构的运算符进行填充,对于常用运算符,此字段未设置。
|
QueryOperator.Type
枚举 |
UNKNOWN |
值无效。 |
INTEGER |
|
DOUBLE |
|
TIMESTAMP |
|
BOOLEAN |
|
ENUM |
|
DATE |
|
TEXT |
|
HTML |
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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` | |"]]