(&self, pattern: ®ex::Regex)
| 312 | } |
| 313 | |
| 314 | pub async fn search_in_sessions(&self, pattern: ®ex::Regex) -> Result<Vec<SearchResult>> { |
| 315 | let sessions = self.list_sessions()?; |
| 316 | let mut results = Vec::new(); |
| 317 | |
| 318 | for session in sessions { |
| 319 | match streaming::read_jsonl_raw(&session.path).await { |
| 320 | Ok(entries) => { |
| 321 | for (idx, entry) in entries.iter().enumerate() { |
| 322 | let entry_str = serde_json::to_string(entry).unwrap_or_default(); |
| 323 | if pattern.is_match(&entry_str) { |
| 324 | results.push(SearchResult { |
| 325 | session_id: session.session_id.clone(), |
| 326 | entry_index: idx, |
| 327 | entry: entry.clone(), |
| 328 | }); |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | Err(e) => tracing::debug!("Failed to load session {}: {}", session.session_id, e), |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | Ok(results) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | #[cfg(test)] |
nothing calls this directly
no test coverage detected