GET/api/v1/document检索站内文档

基于构建期生成的全文索引检索站内文档资源,按相关度降序返回命中文档。Uri 相对站点根。

Request

Query Parameters

NameData TypeRequiredDescription
keywordstringYes检索关键词
limitnumberNo返回条数上限,最大 50(默认值 20)
type QueryParams = {
  /** 检索关键词 */
  keyword: string
  /** 返回条数上限,最大 50,默认值 20 */
  limit?: number
}
{
  "keyword": "错误码",
  "limit": 10
}

Response

Body

NameData TypeRequiredDescription
pathstringYes命中页面路径,相对站点根
titlestringYes页面标题
excerptstringYes命中片段,纯文本
scorenumberYes相关度得分,数值越大越相关
type SearchHitDTO = {
  /** 命中页面路径,相对站点根 */
  path: string
  /** 页面标题 */
  title: string
  /** 命中片段,纯文本 */
  excerpt: string
  /** 相关度得分,数值越大越相关 */
  score: number
}
{
  "path": "cn/api_references/code.html",
  "title": "错误码",
  "excerpt": "……统一响应包装中的 code 字段含义,站点管理接口的业务错误码从 4101 起……",
  "score": 42.5
}

HTTP Code

原始响应,无统一包装,结果仅以 HTTP 状态码表达:

HTTP Status Meaning Notes
200 成功 返回命中列表