/**
 * Search Result Ranker
 *
 * Ranks and sorts search results based on relevance, recency,
 * popularity, and other factors.
 *
 * @since v1.68.0
 */
import type { IndexableDocument, SearchResult, SearchResultType } from './search-types.js';
/**
 * Configuration for ranking
 */
export interface RankingConfig {
    /** Weight for text match score */
    textMatchWeight: number;
    /** Weight for recency (0-1, more recent = higher) */
    recencyWeight: number;
    /** Weight for popularity (downloads, usage) */
    popularityWeight: number;
    /** Weight for type priority */
    typePriorityWeight: number;
    /** Boost for exact matches */
    exactMatchBoost: number;
    /** Boost for title matches vs description */
    titleMatchBoost: number;
    /** Max age for recency calculation (ms) */
    recencyMaxAge: number;
}
/**
 * Default ranking configuration
 */
export declare const DEFAULT_RANKING_CONFIG: RankingConfig;
/**
 * Calculate text match score for a document
 */
export declare function calculateTextScore(query: string, doc: IndexableDocument, config?: Partial<RankingConfig>): number;
/**
 * Calculate recency score (more recent = higher score)
 */
export declare function calculateRecencyScore(timestamp: number | undefined, config?: Partial<RankingConfig>): number;
/**
 * Calculate popularity score (normalized 0-1)
 */
export declare function calculatePopularityScore(value: number | undefined, maxValue?: number): number;
/**
 * Calculate type priority score (0-1, higher = more relevant type)
 */
export declare function calculateTypePriorityScore(type: SearchResultType): number;
/**
 * Calculate final ranking score for a document
 */
export declare function calculateRankingScore(query: string, doc: IndexableDocument, metadata?: {
    timestamp?: number;
    popularity?: number;
    maxPopularity?: number;
}, config?: Partial<RankingConfig>): number;
/**
 * Context for batch ranking
 */
export interface RankingContext {
    /** Maximum popularity value (for normalization) */
    maxPopularity: number;
    /** Custom type priorities (overrides default) */
    typePriorities?: Partial<Record<SearchResultType, number>>;
    /** Boost factors for specific document IDs */
    boosts?: Map<string, number>;
}
/**
 * Rank a list of search results
 */
export declare function rankResults(query: string, results: Array<{
    doc: IndexableDocument;
    indexScore?: number;
    timestamp?: number;
    popularity?: number;
}>, context?: RankingContext, config?: Partial<RankingConfig>): SearchResult[];
/**
 * Group results by type
 */
export declare function groupResultsByType(results: SearchResult[]): Map<SearchResultType, SearchResult[]>;
/**
 * Interleave results from different types for diversity
 */
export declare function interleaveResults(groups: Map<SearchResultType, SearchResult[]>, totalLimit?: number): SearchResult[];
/**
 * Deduplicate results by ID
 */
export declare function deduplicateResults(results: SearchResult[]): SearchResult[];
//# sourceMappingURL=search-ranker.d.ts.map