/**
 * Search Utilities
 *
 * Provides adaptive top-K result filtering and FTS5 query sanitization
 * for the document full-text search system.
 */
export interface ScoredResult<T> {
    item: T;
    score: number;
}
export interface AdaptiveTopKConfig {
    /** Sensitivity for elbow detection (higher = more aggressive cutoff). Default: 1.5 */
    sensitivity?: number;
    /** Minimum number of results to return regardless of elbow. Default: 1 */
    minResults?: number;
    /** Hard cap on maximum results. Default: 50 */
    maxResults?: number;
}
/**
 * Apply adaptive top-K filtering using elbow detection on score distribution.
 *
 * Analyzes gaps between consecutive BM25 scores to find a natural cutoff point
 * where result quality drops significantly. Returns results up to that cutoff.
 *
 * Algorithm:
 * 1. Compute gaps between consecutive scores (already sorted descending by BM25)
 * 2. Calculate mean and stddev of gaps
 * 3. Find first gap exceeding mean + (sensitivity * stddev)
 * 4. Return results up to that cutoff
 *
 * @param results - Scored results sorted by score descending
 * @param config - Configuration for elbow detection
 * @returns Filtered results with natural cutoff applied
 */
export declare function applyAdaptiveTopK<T>(results: ScoredResult<T>[], config?: AdaptiveTopKConfig): ScoredResult<T>[];
/**
 * Escape user input for safe use in FTS5 MATCH queries.
 *
 * FTS5 has special syntax characters that can cause query parse errors.
 * This function wraps each token in quotes to prevent interpretation
 * as FTS5 operators.
 *
 * @param input - Raw user search query
 * @returns Sanitized query safe for FTS5 MATCH
 */
export declare function escapeFts5Query(input: string): string;
//# sourceMappingURL=search-utils.d.ts.map