v3-search-suggestions.yaml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-search-suggestions.yaml
  2. get:
  3. summary: 搜索建议
  4. tags:
  5. - search-suggestions
  6. operationId: get_api_v3_search_suggestions
  7. description: |-
  8. 按已输入的前缀给出补全候选,各字段合并后按分数排序、同一个词只出现一次。
  9. 搜索服务连不上或超时回 503(`search-unavailable`)。
  10. 实现:`V3\SearchSuggestionController@__invoke`
  11. security:
  12. - { }
  13. -
  14. bearerAuth: []
  15. parameters:
  16. -
  17. name: q
  18. in: query
  19. schema:
  20. type: string
  21. description: 已输入的前缀
  22. required: true
  23. -
  24. name: fields
  25. in: query
  26. schema:
  27. type: string
  28. description: '在哪些字段上补全,逗号分隔,可选 title_pali、title_zh、content_pali、content_zh;不传则全部'
  29. example: 'title_pali,content_pali'
  30. -
  31. name: limit
  32. in: query
  33. schema:
  34. type: integer
  35. default: 10
  36. description: '最多返回几条,上限 50'
  37. responses:
  38. 200:
  39. description: 成功
  40. content:
  41. application/json:
  42. schema:
  43. type: object
  44. properties:
  45. data:
  46. type: array
  47. items:
  48. type: object
  49. properties:
  50. text:
  51. type: string
  52. source:
  53. type: string
  54. score:
  55. type: number
  56. doc_id:
  57. type: string
  58. nullable: true
  59. resource_type:
  60. type: string
  61. nullable: true
  62. language:
  63. type: string
  64. nullable: true
  65. granularity:
  66. type: string
  67. nullable: true
  68. category:
  69. type: array
  70. items: { type: string }
  71. meta:
  72. type: object
  73. properties:
  74. total:
  75. type: integer
  76. description: 本次返回的条数
  77. 422:
  78. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  79. 503:
  80. description: 搜索服务暂不可用
  81. content:
  82. application/problem+json:
  83. schema:
  84. $ref: '../../main.yaml#/components/schemas/ProblemDetails'