/// <reference types="node" />
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ReplyUnion, TypeMapping, DoubleReply } from '@redis/client/dist/lib/RESP/types';
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
import { RediSearchLanguage } from './CREATE';
export type FtSearchParams = Record<string, RedisArgument | number>;
export type ScoreExplain = string | Buffer | [string | Buffer, Array<ScoreExplain>];
export declare function parseParamsArgument(parser: CommandParser, params?: FtSearchParams): void;
export interface SearchNumericFilter {
    field: RedisArgument;
    /**
     * Inclusive lower bound. Use `-Infinity` for an open bound, or a string
     * such as `'(10'` for an exclusive bound.
     */
    min: number | RedisArgument;
    /**
     * Inclusive upper bound. Use `Infinity` for an open bound, or a string
     * such as `'(100'` for an exclusive bound.
     */
    max: number | RedisArgument;
}
export interface SearchGeoFilter {
    field: RedisArgument;
    lon: number;
    lat: number;
    radius: number;
    unit: 'm' | 'km' | 'mi' | 'ft';
}
export interface FtSearchOptions {
    VERBATIM?: boolean;
    NOSTOPWORDS?: boolean;
    INKEYS?: RedisVariadicArgument;
    /**
     * Also return the relevance score of each document, exposed as `score` on
     * each reply document.
     */
    WITHSCORES?: boolean;
    /**
     * Return a textual explanation of how each score was computed, exposed as
     * `scoreExplain` on each reply document. Implies `WITHSCORES`.
     */
    EXPLAINSCORE?: boolean;
    /**
     * Also return each document's payload (set at indexing time), exposed as
     * `payload` on each reply document.
     */
    WITHPAYLOADS?: boolean;
    /**
     * Also return the value of the sorting key, exposed as `sortKey` on each
     * reply document. Only relevant together with `SORTBY`.
     */
    WITHSORTKEYS?: boolean;
    /**
     * Limit results to a numeric range on one or more numeric fields.
     */
    FILTER?: SearchNumericFilter | Array<SearchNumericFilter>;
    /**
     * Limit results to a geographic radius on one or more geo fields.
     */
    GEOFILTER?: SearchGeoFilter | Array<SearchGeoFilter>;
    INFIELDS?: RedisVariadicArgument;
    RETURN?: RedisVariadicArgument;
    SUMMARIZE?: boolean | {
        FIELDS?: RedisArgument | Array<RedisArgument>;
        FRAGS?: number;
        LEN?: number;
        SEPARATOR?: RedisArgument;
    };
    HIGHLIGHT?: boolean | {
        FIELDS?: RedisArgument | Array<RedisArgument>;
        TAGS?: {
            open: RedisArgument;
            close: RedisArgument;
        };
    };
    SLOP?: number;
    TIMEOUT?: number;
    INORDER?: boolean;
    LANGUAGE?: RediSearchLanguage;
    EXPANDER?: RedisArgument;
    SCORER?: RedisArgument;
    /**
     * An arbitrary payload passed to the scoring function (see `SCORER`).
     * Not returned in the reply.
     */
    PAYLOAD?: RedisArgument;
    SORTBY?: RedisArgument | {
        BY: RedisArgument;
        DIRECTION?: 'ASC' | 'DESC';
    };
    LIMIT?: {
        from: number | RedisArgument;
        size: number | RedisArgument;
    };
    PARAMS?: FtSearchParams;
    DIALECT?: number;
}
export declare function parseSearchOptions(parser: CommandParser, options?: FtSearchOptions): void;
export type SearchLayoutOptions = {
    WITHSCORES: boolean;
    EXPLAINSCORE: boolean;
    NOCONTENT: boolean;
    WITHPAYLOADS: boolean;
    WITHSORTKEYS: boolean;
    RETURN?: RedisVariadicArgument;
};
export declare function preserveSearchLayout(options?: FtSearchOptions): Readonly<SearchLayoutOptions>;
declare function transformSearchReplyResp2(reply: SearchRawReply, preserve?: any, typeMapping?: TypeMapping): SearchReply;
declare function transformSearchReplyResp3(rawReply: ReplyUnion, preserve?: any, typeMapping?: TypeMapping): SearchReply;
declare const _default: {
    readonly IS_READ_ONLY: true;
    readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtSearchOptions) => void;
    readonly transformReply: {
        readonly 2: typeof transformSearchReplyResp2;
        readonly 3: typeof transformSearchReplyResp3;
    };
};
export default _default;
export type SearchRawReply = Array<unknown>;
interface SearchDocumentValue {
    [key: string]: string | number | null | Array<SearchDocumentValue> | SearchDocumentValue;
}
export interface SearchReply {
    total: number;
    documents: Array<{
        id: string;
        /**
         * Relevance score; present when `WITHSCORES` or `EXPLAINSCORE` was set.
         * A number by default; follows the client's `DOUBLE` type mapping.
         */
        score?: DoubleReply;
        /**
         * Score explanation tree; present when `EXPLAINSCORE` was set.
         */
        scoreExplain?: ScoreExplain;
        /**
         * Document payload; present when `WITHPAYLOADS` was set and the
         * document has a payload.
         */
        payload?: string | Buffer;
        /**
         * Sorting-key value; present when `WITHSORTKEYS` was set and the
         * document has one (see `SORTBY`).
         */
        sortKey?: string | Buffer;
        value: SearchDocumentValue;
    }>;
    /**
     * Warnings returned alongside partial results (e.g. on query timeout under a
     * `return` / `return-strict` on-timeout policy). Only populated on RESP3;
     * always empty on RESP2.
     */
    warnings: Array<string>;
}
//# sourceMappingURL=SEARCH.d.ts.map