feat: add FTS5 full-text search with Spotlight-style overlay

Upgrade rusqlite to bundled-full for FTS5. SearchDb with 3 virtual tables
(messages, tasks, btmsg). SearchOverlay.svelte: Ctrl+Shift+F, 300ms
debounce, grouped results with highlight snippets.
This commit is contained in:
Hibryda 2026-03-12 04:57:29 +01:00
parent b2c379516c
commit 944b48ff13
4 changed files with 819 additions and 0 deletions

View file

@ -0,0 +1,35 @@
use crate::AppState;
use crate::search::SearchResult;
use tauri::State;
#[tauri::command]
pub fn search_init(state: State<'_, AppState>) -> Result<(), String> {
// SearchDb is already initialized during app setup; this is a no-op
// but allows the frontend to confirm readiness.
let _db = &state.search_db;
Ok(())
}
#[tauri::command]
pub fn search_query(
state: State<'_, AppState>,
query: String,
limit: Option<i32>,
) -> Result<Vec<SearchResult>, String> {
state.search_db.search_all(&query, limit.unwrap_or(20))
}
#[tauri::command]
pub fn search_rebuild(state: State<'_, AppState>) -> Result<(), String> {
state.search_db.rebuild_index()
}
#[tauri::command]
pub fn search_index_message(
state: State<'_, AppState>,
session_id: String,
role: String,
content: String,
) -> Result<(), String> {
state.search_db.index_message(&session_id, &role, &content)
}