1 import type {
2 AttributeSchemaConfig,
3 DistanceMetric,
4 FullTextSearch,
5 } from "./api-types"
6
7 export type MedusaSearchProviderOptions = {
8 /**
9 * Bearer token for authenticating with Medusa Cloud search. Used only when
10 * the endpoint is not a basic auth-protected URL.
11 */
12 api_key?: string
13 /**
14 * Medusa Cloud search proxy base URL. Typically a basic auth URL for local access
15 * And a standard HTTP URL in Cloud
16 */
17 endpoint: string
18 /**
19 * Cloud environment handle. Cloud scopes physical storage from this
20 * handle — the provider sends Medusa index names as-is. Used only when the
21 * endpoint is not a basic auth-protected URL, which carries the handle as
22 * the user.
23 */
24 environment_handle?: string
25 /**
26 * @ignore
27 *
28 * Replaces the HTTP transport. It receives the requests that would go to the
29 * Cloud search proxy and must answer as the proxy would.
30 */
31 fetch?: typeof fetch
32 }
33
34 export type ResolvedMedusaSearchProviderOptions =
35 MedusaSearchProviderOptions & {
36 api_key: string
37 environment_handle: string
38 }
39
40 export type MedusaSearchIndexOptions = {
41 distance_metric?: DistanceMetric
42 }
43
44 export type MedusaSearchFieldOptions = {
45 ann?: AttributeSchemaConfig["ann"]
46 full_text_search?: FullTextSearch
47 /**
48 * Build a trigram index so `$prefix` / `$like` filters can glob-match
49 * this string. Defaults to `true` for filterable, sortable, or
50 * facetable keywords. Text fields must set this to `true` explicitly.
51 * Always omitted on `id` — that column is the document key.
52 */
53 glob?: boolean
54 regex?: boolean
55 }
56
57 export type MedusaSearchQueryOptions = {
58 consistency?: "strong" | "eventual"
59 }