/**
 * Full-text search across BRAIN memory using SQLite FTS5.
 * Uses raw SQL via nativeDb because drizzle doesn't support FTS5 virtual tables.
 *
 * Falls back to LIKE queries if FTS5 is not available (some SQLite builds lack it).
 *
 * @task T5130
 * @epic T5149
 */
import type { DatabaseSync } from 'node:sqlite';
import type { BrainDecisionRow, BrainLearningRow, BrainObservationRow, BrainPatternRow } from '../store/brain-schema.js';
/** Search result with BM25 rank. */
export interface BrainSearchResult {
    decisions: BrainDecisionRow[];
    patterns: BrainPatternRow[];
    learnings: BrainLearningRow[];
    observations: BrainObservationRow[];
}
/** Search options. */
export interface BrainSearchOptions {
    /** Max results per table. Default 10. */
    limit?: number;
    /** Which tables to search. Default: all four. */
    tables?: Array<'decisions' | 'patterns' | 'learnings' | 'observations'>;
}
/**
 * Create FTS5 virtual tables and content-sync triggers if they don't exist.
 *
 * Uses content= to sync from main tables, so inserts to main tables
 * auto-populate FTS. UPDATE/DELETE require triggers.
 *
 * @task T5130
 */
export declare function ensureFts5Tables(nativeDb: DatabaseSync): boolean;
/**
 * Rebuild FTS5 indexes from the content tables.
 * Useful after bulk inserts that bypass triggers.
 *
 * @task T5130
 */
export declare function rebuildFts5Index(nativeDb: DatabaseSync): void;
/**
 * Unified search across all BRAIN memory tables.
 *
 * Uses FTS5 MATCH for full-text search with BM25 ranking when available,
 * falls back to LIKE queries otherwise.
 *
 * @task T5130
 */
export declare function searchBrain(projectRoot: string, query: string, options?: BrainSearchOptions): Promise<BrainSearchResult>;
/**
 * Reset the cached FTS5 availability flag.
 * Used in tests to force re-detection.
 */
export declare function resetFts5Cache(): void;
/** Result from hybridSearch combining multiple search signals. */
export interface HybridResult {
    id: string;
    score: number;
    type: string;
    title: string;
    text: string;
    sources: Array<'fts' | 'vec' | 'graph'>;
}
/** Options for hybridSearch weighting and limits. */
export interface HybridSearchOptions {
    ftsWeight?: number;
    vecWeight?: number;
    graphWeight?: number;
    limit?: number;
}
/**
 * Hybrid search across FTS5, vector similarity, and graph neighbors.
 *
 * 1. Runs FTS5 search via existing searchBrain.
 * 2. Runs vector similarity via searchSimilar (if available).
 * 3. Runs graph neighbor expansion via getNeighbors (if query matches a node).
 * 4. Normalizes scores to 0-1 using min-max normalization.
 * 5. Combines with configurable weights.
 * 6. Deduplicates by ID, keeping highest combined score.
 * 7. Returns top-N sorted by score descending.
 *
 * Graceful fallback: if vec unavailable, redistributes weight to FTS5.
 *
 * @param query - Search query text
 * @param projectRoot - Project root directory
 * @param options - Weight and limit configuration
 * @returns Array of hybrid results ranked by combined score
 */
export declare function hybridSearch(query: string, projectRoot: string, options?: HybridSearchOptions): Promise<HybridResult[]>;
//# sourceMappingURL=brain-search.d.ts.map