v3-search.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-search.yaml
  2. get:
  3. summary: 全文检索
  4. tags:
  5. - search
  6. operationId: get_api_v3_search
  7. description: |-
  8. 支持 fuzzy / exact / semantic / hybrid 四种检索模式,底层走 OpenSearch。
  9. 同样的参数也可以用 POST /v3/search 提交(参数多、URL 放不下时用)。
  10. 实现:`V3\SearchPlusController@index`
  11. security:
  12. - { }
  13. -
  14. bearerAuth: []
  15. parameters:
  16. -
  17. name: q
  18. in: query
  19. schema:
  20. type: string
  21. default: ''
  22. description: 搜索关键词
  23. required: true
  24. -
  25. name: page
  26. in: query
  27. schema:
  28. type: integer
  29. default: 1
  30. description: 页码
  31. -
  32. name: page_size
  33. in: query
  34. schema:
  35. type: integer
  36. default: 20
  37. description: '每页数量,上限 100'
  38. -
  39. name: search_mode
  40. in: query
  41. schema:
  42. type: string
  43. enum:
  44. - fuzzy
  45. - exact
  46. - semantic
  47. - hybrid
  48. default: fuzzy
  49. description: 检索模式
  50. -
  51. name: resource_type
  52. in: query
  53. schema:
  54. type: string
  55. enum:
  56. - article
  57. - term
  58. - dictionary
  59. - translation
  60. - origin_text
  61. - nissaya
  62. description: 资源类型
  63. -
  64. name: resource_id
  65. in: query
  66. schema:
  67. type: string
  68. description: '限定某个资源 id'
  69. -
  70. name: granularity
  71. in: query
  72. schema:
  73. type: string
  74. enum:
  75. - book
  76. - chapter
  77. - sutta
  78. - section
  79. - paragraph
  80. - sentence
  81. description: 文档颗粒度
  82. -
  83. name: language
  84. in: query
  85. schema:
  86. type: string
  87. description: 语言
  88. example: zh-Hans
  89. -
  90. name: category
  91. in: query
  92. schema:
  93. type: string
  94. enum:
  95. - pali
  96. - commentary
  97. - subcommentary
  98. description: 文档分类,逗号分隔
  99. -
  100. name: tags
  101. in: query
  102. schema:
  103. type: string
  104. description: 标签过滤,逗号分隔
  105. -
  106. name: page_refs
  107. in: query
  108. schema:
  109. type: array
  110. description: 页码标记
  111. example:
  112. - V3.81
  113. - M3.58
  114. -
  115. name: related_id
  116. in: query
  117. schema:
  118. type: array
  119. description: '关联 id'
  120. example:
  121. - chapter_93-5
  122. - 'm.n. 38'
  123. -
  124. name: author
  125. in: query
  126. schema:
  127. type: string
  128. description: 按作者或译者过滤
  129. -
  130. name: channel
  131. in: query
  132. schema:
  133. type: string
  134. description: '按来源 channel 过滤'
  135. responses:
  136. 200:
  137. description: 成功
  138. content:
  139. application/json:
  140. schema:
  141. type: object
  142. properties:
  143. data:
  144. type: array
  145. items:
  146. type: object
  147. meta:
  148. $ref: '../../main.yaml#/components/schemas/PaginationMeta'
  149. 422:
  150. $ref: '../../main.yaml#/components/responses/ProblemValidation'
  151. post:
  152. summary: 全文检索(POST)
  153. tags:
  154. - search
  155. operationId: post_api_v3_search
  156. description: |-
  157. 与 `GET /v3/search` 完全等价,只是把参数放在请求体里——参数多、
  158. 尤其是 page_refs / related_id 这类数组时,URL 放不下。
  159. 实现:`V3\SearchPlusController@store`
  160. security:
  161. - { }
  162. -
  163. bearerAuth: []
  164. requestBody:
  165. required: true
  166. content:
  167. application/json:
  168. schema:
  169. type: object
  170. properties:
  171. q:
  172. type: string
  173. description: 搜索关键词
  174. search_mode:
  175. type: string
  176. description: 检索模式
  177. enum:
  178. - fuzzy
  179. - exact
  180. - semantic
  181. - hybrid
  182. default: fuzzy
  183. resource_type:
  184. type: string
  185. description: 资源类型
  186. granularity:
  187. type: string
  188. description: 文档颗粒度
  189. language:
  190. type: string
  191. description: 语言
  192. category:
  193. type: string
  194. description: 文档分类,逗号分隔
  195. tags:
  196. type: string
  197. description: 标签,逗号分隔
  198. page_refs:
  199. type: array
  200. description: 页码标记
  201. related_id:
  202. type: array
  203. description: '关联 id'
  204. author:
  205. type: string
  206. description: 作者或译者
  207. channel:
  208. type: string
  209. description: '来源 channel'
  210. page:
  211. type: integer
  212. description: 页码
  213. default: 1
  214. page_size:
  215. type: integer
  216. description: '每页数量,上限 100'
  217. default: 20
  218. required:
  219. - q
  220. responses:
  221. 200:
  222. description: 成功
  223. content:
  224. application/json:
  225. schema:
  226. type: object
  227. properties:
  228. data:
  229. type: object
  230. 422:
  231. $ref: '../../main.yaml#/components/responses/ProblemValidation'