Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(threads): normalize whitespace in search query before matching

Steven Enamakel28f6df04f3f5
diff --git a/crates/openhuman-core/src/threads/ops/search.rs b/crates/openhuman-core/src/threads/ops/search.rs
index 19c2716dc7..7a18984fbb 100644
--- a/crates/openhuman-core/src/threads/ops/search.rs
+++ b/crates/openhuman-core/src/threads/ops/search.rs
@@ -82,7 +82,13 @@ pub(super) fn snippet(content: &str, query: &str) -> String {
.chars()
.collect();
let fold = |c: &char| c.to_lowercase().next().unwrap_or(*c);
- let needle: Vec<char> = query.chars().map(|c| fold(&c)).collect();
+ let needle: Vec<char> = query
+ .split_whitespace()
+ .collect::<Vec<_>>()
+ .join(" ")
+ .chars()
+ .map(|c| fold(&c))
+ .collect();
let lower: Vec<char> = text.iter().map(fold).collect();
let at = if needle.is_empty() || needle.len() > lower.len() {
None