import { BaseService, ServiceConfig, HealthCheckResult } from './base.js';
export interface SearchQuery {
    q: string;
    query_by?: string;
    filter_by?: string;
    sort_by?: string;
    facet_by?: string;
    max_facet_values?: number;
    facet_query?: string;
    num_typos?: string;
    page?: number;
    per_page?: number;
    group_by?: string;
    group_limit?: number;
    include_fields?: string;
    exclude_fields?: string;
    highlight_full_fields?: string;
    highlight_affix_num_tokens?: number;
    highlight_start_tag?: string;
    highlight_end_tag?: string;
    snippet_threshold?: number;
    drop_tokens_threshold?: number;
    typo_tokens_threshold?: number;
    pinned_hits?: string;
    hidden_hits?: string;
    limit_hits?: number;
    search_cutoff_ms?: number;
    use_cache?: boolean;
    cache_ttl?: number;
}
export interface SearchResult<T = any> {
    found: number;
    out_of: number;
    page: number;
    request_params: any;
    search_time_ms: number;
    search_cutoff: boolean;
    hits: SearchHit<T>[];
    facet_counts?: FacetCount[];
    grouped_hits?: GroupedHit<T>[];
}
export interface SearchHit<T = any> {
    document: T;
    highlight?: any;
    highlights?: any[];
    text_match?: number;
    text_match_info?: any;
}
export interface FacetCount {
    field_name: string;
    counts: Array<{
        count: number;
        highlighted: string;
        value: string;
    }>;
    stats?: {
        avg?: number;
        max?: number;
        min?: number;
        sum?: number;
        total_values?: number;
    };
}
export interface GroupedHit<T = any> {
    group_key: string[];
    hits: SearchHit<T>[];
}
export interface IndexInfo {
    name: string;
    num_documents: number;
    fields: Array<{
        name: string;
        type: string;
        facet: boolean;
        index: boolean;
        optional: boolean;
        sort: boolean;
    }>;
    default_sorting_field: string;
    created_at: number;
    token_separators: string[];
    symbols_to_index: string[];
    enable_nested_fields: boolean;
}
export declare class SearchService extends BaseService {
    private searchCount;
    private errorCount;
    private lastHealthCheck;
    private isAvailable;
    constructor(config?: Partial<ServiceConfig>);
    initialize(): Promise<void>;
    protected performHealthCheck(): Promise<HealthCheckResult>;
    search<T = any>(collection: string, searchQuery: SearchQuery, options?: {
        enableFallback?: boolean;
        timeout?: number;
    }): Promise<SearchResult<T>>;
    getCollection(collectionName: string): Promise<IndexInfo>;
    listCollections(): Promise<string[]>;
    multiSearch<T = any>(searches: Array<{
        collection: string;
        query: SearchQuery;
    }>, options?: {
        timeout?: number;
    }): Promise<Array<SearchResult<T>>>;
    private fallbackSearch;
    private isRetryableSearchError;
    private checkAvailability;
    private sanitizeLogData;
    getServiceStats(): {
        searchCount: number;
        errorCount: number;
        successRate: number;
        isAvailable: boolean;
        lastHealthCheck: Date;
    };
    refreshAvailability(): Promise<void>;
    isServiceAvailable(): boolean;
    shutdown(): Promise<void>;
}
export declare const searchService: SearchService;
