1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-09-12 01:49:09 +02:00

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