MCPcopy Create free account
hub / github.com/douglance/devsql / search_in_sessions

Method search_in_sessions

crates/ccql/src/datasources/transcript.rs:314–337  ·  view source on GitHub ↗
(&self, pattern: &regex::Regex)

Source from the content-addressed store, hash-verified

312 }
313
314 pub async fn search_in_sessions(&self, pattern: &regex::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)]

Callers

nothing calls this directly

Calls 2

read_jsonl_rawFunction · 0.85
list_sessionsMethod · 0.80

Tested by

no test coverage detected