fix: don't save empty tokens

This commit is contained in:
Timo Kösters 2021-08-19 14:05:23 +02:00
parent 46d8a46e1f
commit b09499c2df
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4

View file

@ -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::<Vec<_>>();