From b09499c2df67c4fc101fe8cdfb0e2baec91d5b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Thu, 19 Aug 2021 14:05:23 +0200 Subject: [PATCH] fix: don't save empty tokens --- src/database/rooms.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/database/rooms.rs b/src/database/rooms.rs index adb748d0..d3600f18 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -1378,6 +1378,7 @@ impl Rooms { if let Some(body) = pdu.content.get("body").and_then(|b| b.as_str()) { let mut batch = body .split_terminator(|c: char| !c.is_alphanumeric()) + .filter(|s| !s.is_empty()) .filter(|word| word.len() <= 50) .map(str::to_lowercase) .map(|word| { @@ -2702,6 +2703,7 @@ impl Rooms { let words = search_string .split_terminator(|c: char| !c.is_alphanumeric()) + .filter(|s| !s.is_empty()) .map(str::to_lowercase) .collect::>();