feat(search): add search command; route notes.md writes through the store (T8.2, FR-SEARCH-1)

The initial notes.md render after finalize/resume/recovery bypassed
the Store abstraction entirely (raw std::fs::write) — routing it
through update_notes means that first render also gets FTS-indexed and
bumps updated_at, instead of only later manual edits doing either.
This commit is contained in:
iamdoubz
2026-07-02 10:07:29 -05:00
parent 68379f8f56
commit d928dfd51d
+15 -3
View File
@@ -495,7 +495,7 @@ pub async fn stop_recording(
.map_err(|e| WaError::new("storage", e.to_string()))?;
let notes_md = crate::notes::MarkdownNotes.to_markdown(&segments, &speakers, None);
let _ = std::fs::write(meeting_dir(&meeting_id).join("notes.md"), notes_md);
let _ = state.store.update_notes(&meeting_id, &notes_md).await;
let _ = app.emit(
"transcript://finalized",
@@ -899,7 +899,7 @@ pub async fn reprocess_transcript(
.map_err(|e| WaError::new("storage", e.to_string()))?;
let notes_md = crate::notes::MarkdownNotes.to_markdown(&segments, &meeting.speakers, None);
let _ = std::fs::write(meeting_dir(&meeting_id).join("notes.md"), notes_md);
let _ = state.store.update_notes(&meeting_id, &notes_md).await;
let _ = app.emit(
"transcript://finalized",
@@ -981,7 +981,7 @@ pub async fn resume_transcription(
.map_err(|e| WaError::new("storage", e.to_string()))?;
let notes_md = crate::notes::MarkdownNotes.to_markdown(&segments, &speakers, None);
let _ = std::fs::write(meeting_dir(&meeting_id).join("notes.md"), notes_md);
let _ = state.store.update_notes(&meeting_id, &notes_md).await;
let _ = app.emit(
"transcript://finalized",
@@ -1004,6 +1004,18 @@ pub async fn list_meetings(
.map_err(|e| WaError::new("storage", e.to_string()))
}
/// Full-text search across transcripts + notes (Phase 8, FR-SEARCH-1) —
/// distinct from `list_meetings`' `query`, which only substring-matches the
/// title.
#[tauri::command]
pub async fn search(state: State<'_, AppState>, query: String) -> WaResult<Vec<SearchHit>> {
state
.store
.search(&query)
.await
.map_err(|e| WaError::new("storage", e.to_string()))
}
#[tauri::command]
pub async fn get_meeting(state: State<'_, AppState>, meeting_id: MeetingId) -> WaResult<Meeting> {
state