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

fix: keyword search now also searches accessibility text via frames_fts

louis0301950dd535df6d3a
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index 4e1e26701..1be7a1d50 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -3966,7 +3966,7 @@ impl DatabaseManager {
crate::text_normalizer::sanitize_fts5_query(query)
};
conditions.push(
- "f.id IN (SELECT frame_id FROM ocr_text_fts WHERE text MATCH ? ORDER BY rank LIMIT 5000)",
+ "f.id IN (SELECT frame_id FROM ocr_text_fts WHERE text MATCH ? ORDER BY rank LIMIT 5000 UNION SELECT id FROM frames_fts WHERE frames_fts MATCH ? ORDER BY rank LIMIT 5000)",
);
fts_match
} else {
@@ -4072,9 +4072,10 @@ LIMIT ? OFFSET ?
}
}
- // Bind search condition if query is not empty
+ // Bind search condition if query is not empty (twice: once for ocr_text_fts, once for frames_fts)
if !query.is_empty() {
query_builder = query_builder.bind(&search_condition);
+ query_builder = query_builder.bind(&search_condition);
}
// Bind limit and offset
@@ -4150,7 +4151,7 @@ LIMIT ? OFFSET ?
crate::text_normalizer::sanitize_fts5_query(query)
};
conditions.push(
- "f.id IN (SELECT frame_id FROM ocr_text_fts WHERE text MATCH ? ORDER BY rank LIMIT 5000)",
+ "f.id IN (SELECT frame_id FROM ocr_text_fts WHERE text MATCH ? ORDER BY rank LIMIT 5000 UNION SELECT id FROM frames_fts WHERE frames_fts MATCH ? ORDER BY rank LIMIT 5000)",
);
fts_match
} else {
@@ -4230,6 +4231,7 @@ LIMIT ? OFFSET ?
if !query.is_empty() {
query_builder = query_builder.bind(&search_condition);
+ query_builder = query_builder.bind(&search_condition);
}
query_builder = query_builder.bind(limit as i64).bind(offset as i64);