import { SearchTypes } from "@medusajs/framework/types";
/**
 * The original document, stored verbatim. Orama keeps undeclared properties
 * without indexing them, which makes reads lossless — dates come back as dates,
 * and arrays of objects keep their shape despite being collapsed for indexing.
 */
export declare const SOURCE_KEY = "__source";
/**
 * Suffix for the shadow copy of a tokenized field. Orama's `where` on a `string`
 * matches tokens, not whole values — `{ title: "Red shoe" }` also matches "Blue
 * shoe" — so a field that must be both searchable and exactly filterable is
 * indexed twice: `string` for matching, `enum` for filtering and faceting.
 */
export declare const FILTER_SUFFIX = "__filter";
export type OramaFieldType = "string" | "string[]" | "enum" | "enum[]" | "number" | "number[]" | "boolean" | "boolean[]" | "geopoint";
export type PlannedField = {
    path: string;
    type: OramaFieldType;
    is_array: boolean;
    is_date: boolean;
    field: SearchTypes.SearchFieldDefinition;
    filter_path?: string;
    filter_type?: "enum" | "enum[]";
};
export type IndexPlan = {
    schema: Record<string, OramaFieldType>;
    fields: Map<string, PlannedField>;
    searchable: string[];
    primary_key: string;
};
/**
 * Refuses a definition Orama cannot honour, scoped to what makes the index
 * unbuildable or silently wrong. A per-query feature like a stats facet is refused
 * when *requested*, so declaring it does not make the field unusable.
 */
export declare function assertIndexSupported(definition: SearchTypes.ResolvedSearchIndexDefinition): void;
/**
 * Refuses a query Orama cannot honour. The dangerous ones are where it would
 * answer *almost* correctly: a single `sortBy` silently drops extra sort keys, and
 * missing highlighting or cursors would come back silently absent.
 */
export declare function assertQuerySupported(query: SearchTypes.ProviderSearchQuery): void;
/**
 * Flattens a definition into the flat, dot-keyed schema Orama wants.
 *
 * Dotted schema keys resolve against nested documents and, unlike a nested
 * schema, remain sortable — so nesting is flattened here rather than mirrored.
 */
export declare function buildIndexPlan(definition: SearchTypes.ResolvedSearchIndexDefinition): IndexPlan;
/**
 * Whether two plans describe the same physical index. Compared on the built schema
 * rather than the definition hash, so a change that never reaches Orama — a
 * settings-only edit — does not force a needless rebuild.
 */
export declare function sameSchema(a: IndexPlan, b: IndexPlan): boolean;
export declare function toOramaDocument(document: SearchTypes.SearchDocument, plan: IndexPlan): Record<string, unknown>;
export declare function projectDocument(source: Record<string, unknown>, paths: string[]): Record<string, unknown>;
type OramaOperation = Record<string, unknown> | string | number | boolean;
export declare function toOramaWhere(filters: SearchTypes.SearchFilters | undefined, plan: IndexPlan): Record<string, OramaOperation> | undefined;
/**
 * Recognises a filter that is nothing but primary-key membership, so a delete goes
 * straight to `removeMultiple` instead of searching first. `undefined` for
 * anything else, including the primary key alongside other fields.
 */
export declare function extractPrimaryKeyFilter(filters: SearchTypes.SearchFilters, plan: IndexPlan): string[] | undefined;
export type FacetPlan = {
    orama: Record<string, unknown>;
    byOramaKey: Map<string, {
        field: string;
        request: SearchTypes.SearchFacetRequest;
        ranges?: Map<string, {
            key: string;
            from?: number;
            to?: number;
        }>;
    }>;
};
export declare function toOramaFacets(requests: SearchTypes.SearchFacetRequest[] | undefined, plan: IndexPlan): FacetPlan | undefined;
export declare function fromOramaFacets(facets: Record<string, {
    count: number;
    values: Record<string, number>;
}>, plan: FacetPlan): Record<string, SearchTypes.SearchFacetResult>;
export {};
//# sourceMappingURL=index.d.ts.map