/**
 * BM25 Search Implementation
 *
 * In-memory BM25 (Best Match 25) implementation for keyword-based
 * full-text search. Can be used standalone or with FTS5 for SQLite.
 *
 * BM25 is a ranking function used by search engines to rank matching
 * documents according to their relevance to a given search query.
 */
import type { BM25Config, BM25Document, BM25Stats } from './types.js';
/**
 * Simple tokenizer that splits on whitespace and punctuation
 */
export declare function tokenize(text: string): string[];
/**
 * Porter stemmer (simplified version)
 * Reduces words to their root form
 */
export declare function stem(word: string): string;
/**
 * Tokenize and stem text
 */
export declare function tokenizeAndStem(text: string): string[];
/**
 * BM25 search index
 */
export declare class BM25Index {
    private config;
    private documents;
    private documentLengths;
    private termFrequencies;
    private documentFrequencies;
    private avgDocLength;
    constructor(config?: Partial<BM25Config>);
    /**
     * Add a document to the index
     */
    addDocument(doc: BM25Document): void;
    /**
     * Add multiple documents
     */
    addDocuments(docs: BM25Document[]): void;
    /**
     * Remove a document from the index
     */
    removeDocument(docId: string): boolean;
    /**
     * Search the index
     */
    search(query: string, limit?: number): Array<{
        id: string;
        score: number;
    }>;
    /**
     * Get document by ID
     */
    getDocument(docId: string): BM25Document | undefined;
    /**
     * Check if document exists
     */
    hasDocument(docId: string): boolean;
    /**
     * Get index statistics
     */
    getStats(): BM25Stats;
    /**
     * Clear the index
     */
    clear(): void;
    /**
     * Update average document length
     */
    private updateAvgDocLength;
    /**
     * Normalize BM25 scores to 0-1 range
     */
    static normalizeScores(results: Array<{
        id: string;
        score: number;
    }>): Array<{
        id: string;
        score: number;
    }>;
}
/**
 * Get or create a BM25 index by name
 */
export declare function getBM25Index(name?: string, config?: Partial<BM25Config>): BM25Index;
/**
 * Remove a BM25 index
 */
export declare function removeBM25Index(name: string): boolean;
/**
 * Clear all indexes
 */
export declare function clearAllBM25Indexes(): void;
