Method: query.sources.list

返回用户可用于 query.search 和 Suggest API 的来源列表。

注意:执行此 API 需要标准的最终用户帐号。服务帐号无法直接执行 Query 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

用户可以使用 Query API 搜索的来源列表。

JSON 表示法
{
  "source": {
    object (Source)
  },
  "shortName": string,
  "displayName": string,
  "operators": [
    {
      object (QueryOperator)
    }
  ]
}
字段
source

object (Source)

来源的名称

shortName

string

来源的简称或别名。此值可与“source”运算符一起使用。

displayName

string

数据源的显示名。

operators[]

object (QueryOperator)

适用于此来源的所有运算符的列表。

QueryOperator

可在 query.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