/**
 * Search Analytics & Learning
 *
 * Tracks search behavior and patterns to improve search results
 * over time through query analysis and click tracking.
 *
 * @since v1.68.0
 */
import type { SearchResult, SearchResultType } from './search-types.js';
/**
 * A recorded search event
 */
export interface SearchEvent {
    /** Event ID */
    id: string;
    /** Timestamp */
    timestamp: number;
    /** Search query */
    query: string;
    /** Result count */
    resultCount: number;
    /** Search duration in ms */
    duration: number;
    /** Scopes searched */
    scopes?: SearchResultType[];
    /** Session ID */
    sessionId: string;
}
/**
 * A recorded click event
 */
export interface ClickEvent {
    /** Event ID */
    id: string;
    /** Timestamp */
    timestamp: number;
    /** Search query that led to click */
    query: string;
    /** Result ID that was clicked */
    resultId: string;
    /** Result type */
    resultType: SearchResultType;
    /** Position in results (0-indexed) */
    position: number;
    /** Session ID */
    sessionId: string;
}
/**
 * Query statistics
 */
export interface QueryStats {
    /** The query */
    query: string;
    /** Total search count */
    searchCount: number;
    /** Total click count */
    clickCount: number;
    /** Click-through rate */
    ctr: number;
    /** Average result position clicked */
    avgClickPosition: number;
    /** Most clicked result ID */
    topResult?: string;
    /** Last searched */
    lastSearched: number;
}
/**
 * Search analytics summary
 */
export interface AnalyticsSummary {
    /** Total searches */
    totalSearches: number;
    /** Total clicks */
    totalClicks: number;
    /** Overall CTR */
    overallCtr: number;
    /** Average results per search */
    avgResultCount: number;
    /** Average search duration */
    avgDuration: number;
    /** Searches with no results */
    zeroResultSearches: number;
    /** Top queries */
    topQueries: QueryStats[];
    /** Top clicked results */
    topClickedResults: Array<{
        resultId: string;
        clicks: number;
    }>;
    /** Search distribution by scope */
    searchesByScope: Record<SearchResultType, number>;
}
/**
 * Search analytics service
 */
export declare class SearchAnalyticsService {
    private searches;
    private clicks;
    private sessionId;
    private maxEvents;
    constructor(options?: {
        maxEvents?: number;
    });
    /**
     * Record a search event
     */
    recordSearch(query: string, resultCount: number, duration: number, scopes?: SearchResultType[]): SearchEvent;
    /**
     * Record a click event
     */
    recordClick(query: string, result: SearchResult, position: number): ClickEvent;
    /**
     * Get statistics for a specific query
     */
    getQueryStats(query: string): QueryStats | undefined;
    /**
     * Get popular queries
     */
    getPopularQueries(limit?: number): QueryStats[];
    /**
     * Get queries with no results
     */
    getZeroResultQueries(limit?: number): string[];
    /**
     * Get most clicked results
     */
    getTopClickedResults(limit?: number): Array<{
        resultId: string;
        clicks: number;
    }>;
    /**
     * Get analytics summary
     */
    getSummary(): AnalyticsSummary;
    /**
     * Get search boost recommendations
     */
    getBoostRecommendations(): Map<string, number>;
    /**
     * Get query refinement suggestions
     */
    getQueryRefinements(query: string): string[];
    /**
     * Get time-based trends
     */
    getTrends(periodHours?: number): {
        searchesPerHour: number[];
        peakHour: number;
        totalInPeriod: number;
    };
    /**
     * Start a new session
     */
    newSession(): string;
    /**
     * Get current session ID
     */
    getSessionId(): string;
    /**
     * Clear all analytics data
     */
    clear(): void;
    /**
     * Get raw event counts
     */
    getCounts(): {
        searches: number;
        clicks: number;
    };
    /**
     * Export analytics data
     */
    export(): {
        searches: SearchEvent[];
        clicks: ClickEvent[];
    };
    /**
     * Import analytics data
     */
    import(data: {
        searches?: SearchEvent[];
        clicks?: ClickEvent[];
    }): void;
    /**
     * Generate a unique event ID
     */
    private generateEventId;
    /**
     * Generate a session ID
     */
    private generateSessionId;
    /**
     * Trim events to stay within limit
     */
    private trimEvents;
}
/**
 * Get the global search analytics service
 */
export declare function getSearchAnalyticsService(): SearchAnalyticsService;
/**
 * Reset the search analytics service
 */
export declare function resetSearchAnalyticsService(): void;
//# sourceMappingURL=search-analytics.d.ts.map