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: keyword search for app name and window name

Louis Beaumont29dc3ed9f45b
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 2182e2372..ef995ddee 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.2.37"
+version = "0.2.38"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rs
index 2943c1592..ab4d9fcc3 100644
--- a/screenpipe-server/src/db.rs
+++ b/screenpipe-server/src/db.rs
@@ -664,7 +664,7 @@ impl DatabaseManager {
if let Some(_) = app_name {
param_count += 1;
sql.push_str(&format!(
- " AND ocr_text.app_name = ?{} COLLATE NOCASE",
+ " AND ocr_text.app_name LIKE '%' || ?{} || '%' COLLATE NOCASE",
param_count
));
}
@@ -672,7 +672,7 @@ impl DatabaseManager {
if let Some(_) = window_name {
param_count += 1;
sql.push_str(&format!(
- " AND ocr_text.window_name = ?{} COLLATE NOCASE",
+ " AND ocr_text.window_name LIKE '%' || ?{} || '%' COLLATE NOCASE",
param_count
));
}
@@ -897,7 +897,7 @@ impl DatabaseManager {
start_time: Option<DateTime<Utc>>,
end_time: Option<DateTime<Utc>>,
app_name: Option<&str>,
- window_name: Option<&str>, // Add window_name parameter
+ window_name: Option<&str>,
) -> Result<usize, sqlx::Error> {
let mut sql = r#"
SELECT COUNT(*)
@@ -910,11 +910,11 @@ impl DatabaseManager {
.to_string();
if app_name.is_some() {
- sql.push_str(" AND ocr_text.app_name = ?6 COLLATE NOCASE");
+ sql.push_str(" AND ocr_text.app_name LIKE '%' || ?4 || '%' COLLATE NOCASE");
}
if window_name.is_some() {
- sql.push_str(" AND ocr_text.window_name = ?7 COLLATE NOCASE");
+ sql.push_str(" AND ocr_text.window_name LIKE '%' || ?5 || '%' COLLATE NOCASE");
}
let mut query = sqlx::query_as::<_, (i64,)>(&sql)