1 /**
2 * @oas [get] /admin/search
3 * operationId: GetSearch
4 * summary: Search Admin
5 * description: Search entities that have a search index and are defined as search entities in the Medusa Admin.
6 * externalDocs:
7 * description: Medusa Admin Search
8 * url: https://docs.medusajs.com/resources/infrastructure-modules/search/admin-search
9 * x-authenticated: true
10 * parameters:
11 * - name: q
12 * in: query
13 * description: A query to run full-text search against the search index.
14 * required: false
15 * schema:
16 * type: string
17 * title: q
18 * description: A query to run full-text search against the search index.
19 * - name: entity
20 * in: query
21 * description: The entities to run the search against.
22 * required: false
23 * schema:
24 * type: array
25 * description: The entities to run the search against.
26 * items:
27 * type: string
28 * title: entity
29 * description: The name of the entity.
30 * - name: limit
31 * in: query
32 * description: Limit the number of items returned in the list.
33 * required: false
34 * schema:
35 * type: number
36 * title: limit
37 * description: Limit the number of items returned in the list.
38 * externalDocs:
39 * url: "#pagination"
40 * - name: offset
41 * in: query
42 * description: The number of items to skip when retrieving a list.
43 * required: false
44 * schema:
45 * type: number
46 * title: offset
47 * description: The number of items to skip when retrieving a list.
48 * externalDocs:
49 * url: "#pagination"
50 * security:
51 * - api_token: []
52 * - cookie_auth: []
53 * - jwt_token: []
54 * x-codeSamples:
55 * - lang: JavaScript
56 * label: JS SDK
57 * source: |-
58 * import Medusa from "@medusajs/js-sdk"
59 *
60 * export const sdk = new Medusa({
61 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
62 * debug: import.meta.env.DEV,
63 * auth: {
64 * type: "session",
65 * },
66 * })
67 *
68 * sdk.admin.search.list({ q: "shirt", limit: 5 })
69 * .then(({ results }) => {
70 * console.log(results)
71 * })
72 * - lang: Shell
73 * label: cURL
74 * source: |-
75 * curl '{backend_url}/admin/search' \
76 * -H 'Authorization: Bearer {access_token}'
77 * tags:
78 * - Search
79 * responses:
80 * "200":
81 * description: OK
82 * content:
83 * application/json:
84 * schema:
85 * type: object
86 * description: The search results for the requested entities.
87 * required:
88 * - results
89 * properties:
90 * results:
91 * type: array
92 * description: The search results for each entity, in the order the entities were requested.
93 * items:
94 * type: object
95 * description: The search result for a specific entity.
96 * required:
97 * - entity
98 * - data
99 * - count
100 * - offset
101 * - limit
102 * properties:
103 * entity:
104 * type: string
105 * title: entity
106 * description: The name of the entity the search result belongs to.
107 * data:
108 * type: array
109 * description: The documents the index holds, in relevance order.
110 * items:
111 * type: object
112 * description: The document returned by the search index.
113 * count:
114 * type: number
115 * title: count
116 * description: An estimate of the total number of documents matching the search query.
117 * offset:
118 * type: number
119 * title: offset
120 * description: The number of documents to skip before returning results.
121 * limit:
122 * type: number
123 * title: limit
124 * description: The maximum number of documents to return in the result set.
125 * "400":
126 * $ref: "#/components/responses/400_error"
127 * "401":
128 * $ref: "#/components/responses/unauthorized"
129 * "404":
130 * $ref: "#/components/responses/not_found_error"
131 * "409":
132 * $ref: "#/components/responses/invalid_state_error"
133 * "422":
134 * $ref: "#/components/responses/invalid_request_error"
135 * "500":
136 * $ref: "#/components/responses/500_error"
137 *
138 */
139