import type { MedusaRequest } from '@medusajs/framework'; import type { SearchTypes } from '@medusajs/types'; import z from 'zod'; export interface MeiliHitsEnvelope { hits: Record[]; query: string; processingTimeMs: number; estimatedTotalHits: number; limit: number; offset: number; facets?: Record; hybridSearch?: boolean; semanticRatio?: number; } export interface SearchRequestParams { query?: string; index?: string; limit?: number; offset?: number; language?: string; semanticSearch: boolean; semanticRatio: number; embedder?: string; filter?: string; sort?: string; facets?: string[]; fields?: string[]; } export declare const HitsSearchSchema: z.ZodObject<{ query: z.ZodString; index: z.ZodOptional; limit: z.ZodDefault>; offset: z.ZodDefault>; language: z.ZodOptional; semanticSearch: z.ZodDefault]>>; semanticRatio: z.ZodDefault>; embedder: z.ZodOptional; filter: z.ZodOptional; sort: z.ZodOptional]>>; facets: z.ZodOptional]>>; fields: z.ZodOptional; }, z.core.$strip>; export type HitsSearchParams = z.infer; export declare function toSearchRequestParams(params: HitsSearchParams): SearchRequestParams; export declare function resolveSearchModule(req: MedusaRequest): SearchTypes.ISearchModuleService; export declare function toIndexNames(indexes: ReadonlyArray): string[]; export type SearchIndexLister = { listIndexes(): ReadonlyArray | Promise>; }; export declare function resolveSearchIndexName(input: { searchModule: SearchIndexLister; entity: string; locale?: string; explicitIndex?: string; }): Promise; export declare function findSearchIndexDefinition(name: string): SearchTypes.SearchIndexDefinition | undefined; export declare function buildSearchOptions(input: { definition?: SearchTypes.SearchIndexDefinition; params: SearchRequestParams; includeScore?: boolean; }): SearchTypes.SearchOptions; export declare function findVectorField(definition: SearchTypes.SearchIndexDefinition | undefined): { path: string; field: SearchTypes.SearchFieldDefinition; } | undefined; /** * Mirrors the scope native `POST /store/search` puts on product indexes: published products in the publishable key's * sales channels, for each of the two fields the index declares filterable. */ export declare function productScopeFilters(definition: SearchTypes.SearchIndexDefinition | undefined, salesChannelIds: string[] | undefined): SearchTypes.SearchFilters; export declare function findEmbedderName(definition: SearchTypes.SearchIndexDefinition | undefined): string | undefined; export declare function runHitsSearch(req: MedusaRequest, entity: string, params: SearchRequestParams): Promise; export declare function toHitsEnvelope(result: SearchTypes.SearchResult, params: SearchRequestParams): MeiliHitsEnvelope; export declare function searchDocumentIds(req: MedusaRequest, entity: string, params: SearchRequestParams, scope?: { salesChannelIds?: string[]; }): Promise<{ ids: string[]; count: number; }>; export declare function toStringArray(value: string | string[] | undefined): string[] | undefined; /** * Narrows the engine's ids to an `id` filter already on the request (the products of the allowed sales channels, or ids * the caller asked for), keeping the engine's order. */ export declare function restrictIds(ids: string[], existing: unknown): string[]; //# sourceMappingURL=search.d.ts.map