Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: use FTS for window and app name #964

Louis Beaumontfe11df09e57e
diff --git a/content/docs/pages/docs/plugins.mdx b/content/docs/pages/docs/plugins.mdx
index 7e30baf2d..483b941f5 100644
--- a/content/docs/pages/docs/plugins.mdx
+++ b/content/docs/pages/docs/plugins.mdx
@@ -30,11 +30,11 @@ regardless of progress in AI architecture, it's as good as the given context. sc
#### killer features
- **ai flexibility**: OpenAI, local LLMs (ollama), Anthropic, Gemini, etc.
- **rich APIs**:
- - `pipe.input` for keyboard/mouse control
- `pipe.queryScreenpipe` for context
- `pipe.settings` for app settings
- - experimental `pipe.streamTranscriptions` for audio transcription streaming (atm uses a lot of RAM, make sure to enable it in settings/CLI)
- - experimental `pipe.streamVision` for OCR/Accessibility streaming (atm uses a lot of RAM)
+ - experimental `pipe.streamTranscriptions` for audio transcription streaming (make sure to enable it in settings)
+ - experimental `pipe.streamVision` for OCR/Accessibility/Frames/browser URL streaming
+ - experimental `pipe.input` for keyboard/mouse control
- **sandboxed & cross-platform**: safe execution on all OS
- **real-time**: process screen & audio as it happens
- **cron jobs**: schedule your pipes to run at specific times, same API as Vercel
@@ -46,12 +46,14 @@ regardless of progress in AI architecture, it's as good as the given context. sc
<MotionDiv delay={0.5}>
+we recommend using `bun`, [install](https://bun.sh/docs/installation) or make sure it's up to date.
+
The fastest way to create a new pipe is using our CLI:
<Tabs items={['bun', 'npm', , 'yarn', 'pnpm']}>
<Tab>
```bash copy
-bunx --bun @screenpipe/dev@latest pipe create
+ bunx --bun @screenpipe/dev@latest pipe create
```
</Tab>
<Tab>
@@ -126,12 +128,12 @@ when you're ready to deploy, send a PR to the [screenpipe repo](https://github.c
| **pipe** | **description** | **link** |
| ------------------------------------ | ------------------------------------------------ | --------------------------------- |
+| **obsidian logs** | automate your second brain by logging activities to obsidian | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/obsidian) |
| **memories gallery** | google-photo like gallery of your screen recordings with AI insights | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/memories) |
| **data table** | explore your data in a powerful table view with filtering and sorting | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/data-table) |
| **search** | search through your screen recordings and audio transcripts with AI | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/search) |
| **rewind** | visualize your day with AI-powered timeline of activities | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/rewind) |
| **speaker identification** | automatically identify and label different speakers using AI | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/identify-speakers) |
-| **obsidian logs** | automate your second brain by logging activities to obsidian | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/obsidian) |
| **meeting assistant** | organize and summarize meetings with AI - get transcripts and insights | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/meeting) |
| **linkedin ai agent** | automate business development on linkedin | [link](https://github.com/mediar-ai/screenpipe/tree/main/pipes/linkedin-ai-assistant) |
@@ -146,6 +148,7 @@ paste these links into your Cursor chat for context:
- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/browser-sdk/src/index.ts
- https://github.com/mediar-ai/screenpipe/blob/main/pipes/obsidian/src/app/api/log/route.ts
- https://github.com/mediar-ai/screenpipe/blob/main/pipes/search/src/components/search-chat.tsx
+- https://github.com/mediar-ai/screenpipe/blob/main/pipes/rewind/src/lib/hooks/use-app-name-suggestion.tsx
- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-server/src/server.rs
- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-core/src/pipes.rs
diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rs
index 3ece39499..b7a0feea2 100644
--- a/screenpipe-server/src/db.rs
+++ b/screenpipe-server/src/db.rs
@@ -729,13 +729,28 @@ impl DatabaseManager {
max_length: Option<usize>,
frame_name: Option<&str>,
) -> Result<Vec<OCRResult>, sqlx::Error> {
- let base_sql = if query.is_empty() {
- "ocr_text"
- } else {
- "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id"
- };
+ // combine the individual search aspects into a single fts query string
+ let mut fts_parts = Vec::new();
+ if !query.is_empty() {
+ fts_parts.push(query.to_owned());
+ }
+ if let Some(app) = app_name {
+ if !app.is_empty() {
+ // fts field lookup for app_name using SQLite fts syntax
+ fts_parts.push(format!("app_name:\"{}\"", app));
+ }
+ }
+ if let Some(window) = window_name {
+ if !window.is_empty() {
+ // fts field lookup for window_name
+ fts_parts.push(format!("window_name:\"{}\"", window));
+ }
+ }
+ let combined_query = fts_parts.join(" ");
- let where_clause = if query.is_empty() {
+ // always use the fts table so that the field-specific match works
+ let base_sql = "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id";
+ let where_clause = if combined_query.is_empty() {
"WHERE 1=1"
} else {
"WHERE ocr_text_fts MATCH ?1"
@@ -764,24 +779,24 @@ impl DatabaseManager {
{}
AND (?2 IS NULL OR frames.timestamp >= ?2)
AND (?3 IS NULL OR frames.timestamp <= ?3)
- AND (?4 IS NULL OR ocr_text.app_name LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ocr_text.window_name LIKE '%' || ?5 || '%')
- AND (?6 IS NULL OR COALESCE(ocr_text.text_length,LENGTH(ocr_text.text)) >= ?6)
- AND (?7 IS NULL OR COALESCE(ocr_text.text_length,LENGTH(ocr_text.text)) <= ?7)
- AND (?8 IS NULL OR frames.name LIKE '%' || ?8 || '%' COLLATE NOCASE)
+ AND (?4 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) <= ?5)
+ AND (?6 IS NULL OR frames.name LIKE '%' || ?6 || '%' COLLATE NOCASE)
GROUP BY ocr_text.frame_id
ORDER BY frames.timestamp DESC
- LIMIT ?9 OFFSET ?10
+ LIMIT ?7 OFFSET ?8
"#,
base_sql, where_clause
);
let raw_results: Vec<OCRResultRaw> = sqlx::query_as(&sql)
- .bind(query)
+ .bind(if combined_query.is_empty() {
+ "".to_owned()
+ } else {
+ combined_query
+ })
.bind(start_time)
.bind(end_time)
- .bind(app_name)
- .bind(window_name)
.bind(min_length.map(|l| l as i64))
.bind(max_length.map(|l| l as i64))
.bind(frame_name)
@@ -967,166 +982,181 @@ impl DatabaseManager {
"[]".to_string()
};
+ // build combined fts queries
+ let (ocr_fts_query, ui_fts_query) = {
+ let mut ocr_parts = vec![];
+ let mut ui_parts = vec![];
+
+ if !query.is_empty() {
+ ocr_parts.push(query.to_owned());
+ ui_parts.push(query.to_owned());
+ }
+
+ if let Some(app) = app_name {
+ ocr_parts.push(format!("app_name:\"{}\"", app));
+ ui_parts.push(format!("app:\"{}\"", app));
+ }
+
+ if let Some(window) = window_name {
+ ocr_parts.push(format!("window_name:\"{}\"", window));
+ ui_parts.push(format!("window:\"{}\"", window));
+ }
+
+ (ocr_parts.join(" "), ui_parts.join(" "))
+ };
+
let sql = match content_type {
- ContentType::OCR => {
- format!(
- r#"
- SELECT COUNT(DISTINCT frames.id)
- FROM {table}
+ ContentType::OCR => format!(
+ r#"SELECT COUNT(DISTINCT frames.id)
+ FROM {table}
+ JOIN frames ON ocr_text.frame_id = frames.id
+ WHERE {match_condition}
+ AND (?2 IS NULL OR frames.timestamp >= ?2)
+ AND (?3 IS NULL OR frames.timestamp <= ?3)
+ AND (?4 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) <= ?5)
+ AND (?6 IS NULL OR frames.name LIKE '%' || ?6 || '%')"#,
+ table = if ocr_fts_query.is_empty() {
+ "ocr_text"
+ } else {
+ "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id"
+ },
+ match_condition = if ocr_fts_query.is_empty() {
+ "1=1"
+ } else {
+ "ocr_text_fts MATCH ?1"
+ }
+ ),
+ ContentType::UI => format!(
+ r#"SELECT COUNT(DISTINCT ui_monitoring.id)
+ FROM {table}
+ WHERE {match_condition}
+ AND (?2 IS NULL OR timestamp >= ?2)
+ AND (?3 IS NULL OR timestamp <= ?3)
+ AND (?4 IS NULL OR COALESCE(text_length, LENGTH(text_output)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(text_length, LENGTH(text_output)) <= ?5)"#,
+ table = if ui_fts_query.is_empty() {
+ "ui_monitoring"
+ } else {
+ "ui_monitoring_fts JOIN ui_monitoring ON ui_monitoring_fts.ui_id = ui_monitoring.id"
+ },
+ match_condition = if ui_fts_query.is_empty() {
+ "1=1"
+ } else {
+ "ui_monitoring_fts MATCH ?1"
+ }
+ ),
+ ContentType::Audio => format!(
+ r#"SELECT COUNT(DISTINCT audio_transcriptions.id)
+ FROM {table}
+ WHERE {match_condition}
+ AND (?2 IS NULL OR audio_transcriptions.timestamp >= ?2)
+ AND (?3 IS NULL OR audio_transcriptions.timestamp <= ?3)
+ AND (?4 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) <= ?5)
+ AND (json_array_length(?6) = 0 OR audio_transcriptions.speaker_id IN (SELECT value FROM json_each(?6)))
+ "#,
+ table = if query.is_empty() {
+ "audio_transcriptions"
+ } else {
+ "audio_transcriptions_fts JOIN audio_transcriptions ON audio_transcriptions_fts.audio_chunk_id = audio_transcriptions.audio_chunk_id"
+ },
+ match_condition = if query.is_empty() {
+ "1=1"
+ } else {
+ "audio_transcriptions_fts MATCH ?1"
+ }
+ ),
+ ContentType::All => format!(
+ r#"SELECT COUNT(*) FROM (
+ SELECT DISTINCT frames.id FROM {ocr_table}
JOIN frames ON ocr_text.frame_id = frames.id
- WHERE {match_condition}
+ WHERE {ocr_match}
AND (?2 IS NULL OR frames.timestamp >= ?2)
AND (?3 IS NULL OR frames.timestamp <= ?3)
- AND (?4 IS NULL OR ocr_text.app_name LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ocr_text.window_name LIKE '%' || ?5 || '%')
- AND (?6 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) >= ?6)
- AND (?7 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) <= ?7)
- AND (?8 IS NULL OR frames.name LIKE '%' || ?8 || '%' COLLATE NOCASE)
- "#,
- table = if query.is_empty() {
- "ocr_text"
- } else {
- "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id"
- },
- match_condition = if query.is_empty() {
- "1=1"
- } else {
- "ocr_text_fts MATCH ?1"
- }
- )
- }
- ContentType::Audio => {
- format!(
- r#"
- SELECT COUNT(DISTINCT audio_transcriptions.audio_chunk_id || '_' || COALESCE(audio_transcriptions.start_time, '') || '_' || COALESCE(audio_transcriptions.end_time, ''))
- FROM {table}
- WHERE {match_condition}
- AND (?2 IS NULL OR audio_transcriptions.timestamp >= ?2)
- AND (?3 IS NULL OR audio_transcriptions.timestamp <= ?3)
- AND (?4 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) >= ?4)
- AND (?5 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) <= ?5)
- AND (json_array_length(?6) = 0 OR audio_transcriptions.speaker_id IN (SELECT value FROM json_each(?6)))
- "#,
- table = if query.is_empty() {
- "audio_transcriptions"
- } else {
- "audio_transcriptions_fts JOIN audio_transcriptions ON audio_transcriptions_fts.audio_chunk_id = audio_transcriptions.audio_chunk_id"
- },
- match_condition = if query.is_empty() {
- "1=1"
- } else {
- "audio_transcriptions_fts MATCH ?1"
- }
- )
- }
- ContentType::UI => {
- format!(
- r#"
- SELECT COUNT(DISTINCT ui_monitoring.id)
- FROM {table}
- WHERE {match_condition}
- AND (?2 IS NULL OR ui_monitoring.timestamp >= ?2)
- AND (?3 IS NULL OR ui_monitoring.timestamp <= ?3)
- AND (?4 IS NULL OR ui_monitoring.app LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ui_monitoring.window LIKE '%' || ?5 || '%')
- AND (?6 IS NULL OR COALESCE(ui_monitoring.text_length, LENGTH(ui_monitoring.text_output)) >= ?6)
- AND (?7 IS NULL OR COALESCE(ui_monitoring.text_length, LENGTH(ui_monitoring.text_output)) <= ?7)
- "#,
- table = if query.is_empty() {
- "ui_monitoring"
- } else {
- "ui_monitoring_fts JOIN ui_monitoring ON ui_monitoring_fts.ui_id = ui_monitoring.id"
- },
- match_condition = if query.is_empty() {
- "1=1"
- } else {
- "ui_monitoring_fts MATCH ?1"
- }
- )
- }
- ContentType::All => {
- format!(
- r#"
- SELECT COUNT(*) FROM (
- -- OCR part
- SELECT DISTINCT frames.id
- FROM {ocr_table}
- JOIN frames ON ocr_text.frame_id = frames.id
- WHERE {ocr_match}
- AND (?2 IS NULL OR frames.timestamp >= ?2)
- AND (?3 IS NULL OR frames.timestamp <= ?3)
- AND (?4 IS NULL OR ocr_text.app_name LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ocr_text.window_name LIKE '%' || ?5 || '%')
- AND (?6 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) >= ?6)
- AND (?7 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) <= ?7)
- AND (?8 IS NULL OR frames.name LIKE '%' || ?8 || '%' COLLATE NOCASE)
- UNION ALL
- -- Audio part
- SELECT DISTINCT audio_transcriptions.id
- FROM {audio_table}
- WHERE {audio_match}
- AND (?2 IS NULL OR audio_transcriptions.timestamp >= ?2)
- AND (?3 IS NULL OR audio_transcriptions.timestamp <= ?3)
- AND (?6 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) >= ?6)
- AND (?7 IS NULL OR COALESCE(audio_transcriptions.text_length, LENGTH(audio_transcriptions.transcription)) <= ?7)
- AND audio_transcriptions.transcription != ''
- AND (json_array_length(?9) = 0 OR audio_transcriptions.speaker_id IN (SELECT value FROM json_each(?9)))
- UNION ALL
- -- UI part
- SELECT DISTINCT ui_monitoring.id
- FROM {ui_table}
- WHERE {ui_match}
- AND (?2 IS NULL OR ui_monitoring.timestamp >= ?2)
- AND (?3 IS NULL OR ui_monitoring.timestamp <= ?3)
- AND (?4 IS NULL OR ui_monitoring.app LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ui_monitoring.window LIKE '%' || ?5 || '%')
- AND (?6 IS NULL OR COALESCE(ui_monitoring.text_length, LENGTH(ui_monitoring.text_output)) >= ?6)
- AND (?7 IS NULL OR COALESCE(ui_monitoring.text_length, LENGTH(ui_monitoring.text_output)) <= ?7)
- AND ui_monitoring.text_output != ''
- )"#,
- ocr_table = if query.is_empty() {
- "ocr_text"
- } else {
- "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id"
- },
- ocr_match = if query.is_empty() {
- "1=1"
- } else {
- "ocr_text_fts MATCH ?1"
- },
- audio_table = if query.is_empty() {
- "audio_transcriptions"
- } else {
- "audio_transcriptions_fts JOIN audio_transcriptions ON audio_transcriptions_fts.audio_chunk_id = audio_transcriptions.audio_chunk_id"
- },
- audio_match = if query.is_empty() {
- "1=1"
- } else {
- "audio_transcriptions_fts MATCH ?1"
- },
- ui_table = if query.is_empty() {
- "ui_monitoring"
- } else {
- "ui_monitoring_fts JOIN ui_monitoring ON ui_monitoring_fts.ui_id = ui_monitoring.id"
- },
- ui_match = if query.is_empty() {
- "1=1"
- } else {
- "ui_monitoring_fts MATCH ?1"
- }
- )
- }
+ AND (?4 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(ocr_text.text_length, LENGTH(ocr_text.text)) <= ?5)
+ AND (?6 IS NULL OR frames.name LIKE '%' || ?6 || '%')
+ UNION ALL
+ SELECT DISTINCT id FROM {audio_table}
+ WHERE {audio_match}
+ AND (?2 IS NULL OR timestamp >= ?2)
+ AND (?3 IS NULL OR timestamp <= ?3)
+ AND (?4 IS NULL OR COALESCE(text_length, LENGTH(transcription)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(text_length, LENGTH(transcription)) <= ?5)
+ AND (json_array_length(?6) = 0 OR speaker_id IN (SELECT value FROM json_each(?6)))
+ UNION ALL
+ SELECT DISTINCT id FROM {ui_table}
+ WHERE {ui_match}
+ AND (?2 IS NULL OR timestamp >= ?2)
+ AND (?3 IS NULL OR timestamp <= ?3)
+ AND (?4 IS NULL OR COALESCE(text_length, LENGTH(text_output)) >= ?4)
+ AND (?5 IS NULL OR COALESCE(text_length, LENGTH(text_output)) <= ?5)
+ )"#,
+ ocr_table = if ocr_fts_query.is_empty() {
+ "ocr_text"
+ } else {
+ "ocr_text_fts JOIN ocr_text ON ocr_text_fts.frame_id = ocr_text.frame_id"
+ },
+ ocr_match = if ocr_fts_query.is_empty() {
+ "1=1"
+ } else {
+ "ocr_text_fts MATCH ?1"
+ },
+ audio_table = if query.is_empty() {
+ "audio_transcriptions"
+ } else {
+ "audio_transcriptions_fts JOIN audio_transcriptions ON audio_transcriptions_fts.audio_chunk_id = audio_transcriptions.audio_chunk_id"
+ },
+ audio_match = if query.is_empty() {
+ "1=1"
+ } else {
+ "audio_transcriptions_fts MATCH ?1"
+ },
+ ui_table = if ui_fts_query.is_empty() {
+ "ui_monitoring"
+ } else {
+ "ui_monitoring_fts JOIN ui_monitoring ON ui_monitoring_fts.ui_id = ui_monitoring.id"
+ },
+ ui_match = if ui_fts_query.is_empty() {
+ "1=1"
+ } else {
+ "ui_monitoring_fts MATCH ?1"
+ }
+ ),
_ => return Ok(0),
};
let count: i64 = match content_type {
- ContentType::Audio => {
+ ContentType::OCR => {
sqlx::query_scalar(&sql)
- .bind(query)
+ .bind(ocr_fts_query)
.bind(start_time)
.bind(end_time)
.bind(min_length.map(|l| l as i64))
.bind(max_length.map(|l| l as i64))
+ .bind(frame_name)
+ .fetch_one(&self.pool)
+ .await?
+ }
+ ContentType::UI => {
+ sqlx::query_scalar(&sql)
+ .bind(ui_fts_query)
+ .bind(start_time)
+ .bind(end_time)
+ .bind(min_length.map(|l| l as i64))
+ .bind(max_length.map(|l| l as i64))
+ .fetch_one(&self.pool)
+ .await?
+ }
+ ContentType::All => {
+ sqlx::query_scalar(&sql)
+ .bind(ocr_fts_query)
+ .bind(start_time)
+ .bind(end_time)
+ .bind(min_length.map(|l| l as i64))
+ .bind(max_length.map(|l| l as i64))
+ .bind(frame_name)
.bind(json_array)
.fetch_one(&self.pool)
.await?
@@ -1136,9 +1166,6 @@ impl DatabaseManager {
.bind(query)
.bind(start_time)
.bind(end_time)
- .bind(app_name)
- .bind(window_name)
- .bind(frame_name)
.bind(min_length.map(|l| l as i64))
.bind(max_length.map(|l| l as i64))
.bind(json_array)
@@ -1531,13 +1558,26 @@ impl DatabaseManager {
limit: u32,
offset: u32,
) -> Result<Vec<UiContent>, sqlx::Error> {
- let base_sql = if query.is_empty() {
+ // combine search aspects into single fts query
+ let mut fts_parts = Vec::new();
+ if !query.is_empty() {
+ fts_parts.push(query.to_owned());
+ }
+ if let Some(app) = app_name {
+ fts_parts.push(format!("app:\"{}\"", app));
+ }
+ if let Some(window) = window_name {
+ fts_parts.push(format!("window:\"{}\"", window));
+ }
+ let combined_query = fts_parts.join(" ");
+
+ let base_sql = if combined_query.is_empty() {
"ui_monitoring"
} else {
"ui_monitoring_fts JOIN ui_monitoring ON ui_monitoring_fts.ui_id = ui_monitoring.id"
};
- let where_clause = if query.is_empty() {
+ let where_clause = if combined_query.is_empty() {
"WHERE 1=1"
} else {
"WHERE ui_monitoring_fts MATCH ?1"
@@ -1565,20 +1605,20 @@ impl DatabaseManager {
{}
AND (?2 IS NULL OR ui_monitoring.timestamp >= ?2)
AND (?3 IS NULL OR ui_monitoring.timestamp <= ?3)
- AND (?4 IS NULL OR ui_monitoring.app LIKE '%' || ?4 || '%')
- AND (?5 IS NULL OR ui_monitoring.window LIKE '%' || ?5 || '%')
ORDER BY ui_monitoring.timestamp DESC
- LIMIT ?6 OFFSET ?7
+ LIMIT ?4 OFFSET ?5
"#,
base_sql, where_clause
);
sqlx::query_as(&sql)
- .bind(query)
+ .bind(if combined_query.is_empty() {
+ "".to_owned()
+ } else {
+ combined_query
+ })
.bind(start_time)
.bind(end_time)
- .bind(app_name)
- .bind(window_name)
.bind(limit)
.bind(offset)
.fetch_all(&self.pool)