import type { FuzzySearchOptions, FuzzyMatch } from './fuzzy'; export interface SearchOptions { cursor?: string; limit?: number; fuzzy?: boolean; fuzzyOptions?: FuzzySearchOptions; collection?: string; } export interface SearchResult { _id: string; _match: Record; [key: string]: unknown; } export interface SearchQueryResponse { results: SearchResult[]; total: number; nextCursor: string | null; prevCursor: string | null; fuzzyMatches?: Record; } export interface IndexableDocument { _id: string; [key: string]: unknown; } export interface SearchIndexResult { RESULT: SearchResult[]; RESULT_LENGTH: number; } export interface SearchIndex { PUT: (docs: IndexableDocument[]) => Promise; DELETE: (ids: string[]) => Promise; QUERY: (query: { AND: string[]; } | { OR: string[]; } | { AND: (string | { OR: string[]; })[]; }, options?: { PAGE?: { NUMBER: number; SIZE: number; }; }) => Promise; DICTIONARY: (token?: { FIELD: string; }) => Promise; } export type SearchClient = { query: (query: string, options?: SearchOptions) => Promise; put: (docs: IndexableDocument[] | Record[]) => Promise; del: (ids: string[]) => Promise; onStartIndexing?: () => Promise; onFinishIndexing?: () => Promise; supportsClientSideIndexing?: () => boolean; getDefaultLimit?: () => number; };