import { SearchTypes } from "@medusajs/framework/types"; import { SearchIndexContext, SearchIndexes, SearchIndexVersionRecord } from "../types"; export declare enum SearchIndexState { PENDING = "pending", BUILDING = "building", READY = "ready", ERROR = "error" } export declare enum SearchSyncStatus { PENDING = "pending", PROCESSING = "processing", DONE = "done", FAILED = "failed", CANCELED = "canceled" } export declare const DEFAULT_REINDEX_BATCH_SIZE = 100; export type FlatSearchField = { path: string; field: SearchTypes.SearchFieldDefinition; }; export declare function flattenFields(fields: Record, prefix?: string): FlatSearchField[]; export declare function isSearchable(field: SearchTypes.SearchFieldDefinition): boolean; export declare function isFacetable(field: SearchTypes.SearchFieldDefinition, kind: SearchTypes.SearchFacetKind): boolean; /** * The dotted paths an index can hand back on hits. Object containers are * excluded — only their declared leaves are stored, so returning the container * would silently hand back a partial object. */ export declare function listRetrievablePaths(fields: Record): string[]; /** * Leaf fields the index stores, with the capabilities declared on each. Object * containers are omitted — only their leaves are indexed. */ export declare function listIndexedFields(fields: Record): SearchTypes.SearchIndexFieldInfo[]; export declare function normalizeSearchQuery({ query, index, }: { query: SearchTypes.SearchQuery; index: SearchTypes.ResolvedSearchIndexDefinition; }): SearchTypes.ProviderSearchQuery; /** * The base query plus one per faceted field with that field's own filter dropped. * Every engine reviewed needs a query per facet, so the fan-out lives here rather * than in each provider. The expanded set is then handed to `provider.searchMany` * so the engine can pack them into one round-trip. `disjunctive_facets` is * stripped from what is handed on — a provider should never see an option it is * not expected to act on. */ export declare function buildDisjunctiveFacetQueries(query: SearchTypes.ProviderSearchQuery): { base: SearchTypes.ProviderSearchQuery; per_facet: Map; }; export declare function mergeDisjunctiveFacetResults({ base, per_facet, }: { base: SearchTypes.SearchResult; per_facet: Map; }): SearchTypes.SearchResult; export declare function validateFieldUsage({ index, query, }: { index: SearchTypes.ResolvedSearchIndexDefinition; query: Pick; }): void; /** * Resolves every definition once, at construction. Duplicates and incoherent * definitions fail here, so everything downstream can treat the result as given. */ export declare function resolveIndexDefinitions({ definitions, default_provider, index_prefix, }: { definitions: SearchTypes.SearchIndexDefinition[]; default_provider: string; index_prefix?: string; }): SearchIndexes; /** Every version of every listed index, grouped by the index's id, newest first. */ export declare function listVersionsByIndexId(context: Pick, indexIds: string[]): Promise>; /** * The definition merged with whichever physical index and provider currently * serve reads/writes. Every *live* operation (a direct write, an event * ingested, a query) must resolve through this rather than * `definition.physical_name` directly — that field is only the root a * version's name is derived from, and which version is active can change out * from under this process. */ export declare function resolveActiveDefinition(context: Pick, name: string): Promise; export declare function retrieveIndexDefinition(indexes: SearchIndexes, name: string): SearchTypes.ResolvedSearchIndexDefinition; export declare function assertTaskAccepted(task: SearchTypes.SearchTask, index: string): SearchTypes.SearchTask; //# sourceMappingURL=index.d.ts.map