fix: don't save empty tokens
This commit is contained in:
		
							parent
							
								
									46d8a46e1f
								
							
						
					
					
						commit
						b09499c2df
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		|  | @ -1378,6 +1378,7 @@ impl Rooms { | ||||||
|                 if let Some(body) = pdu.content.get("body").and_then(|b| b.as_str()) { |                 if let Some(body) = pdu.content.get("body").and_then(|b| b.as_str()) { | ||||||
|                     let mut batch = body |                     let mut batch = body | ||||||
|                         .split_terminator(|c: char| !c.is_alphanumeric()) |                         .split_terminator(|c: char| !c.is_alphanumeric()) | ||||||
|  |                         .filter(|s| !s.is_empty()) | ||||||
|                         .filter(|word| word.len() <= 50) |                         .filter(|word| word.len() <= 50) | ||||||
|                         .map(str::to_lowercase) |                         .map(str::to_lowercase) | ||||||
|                         .map(|word| { |                         .map(|word| { | ||||||
|  | @ -2702,6 +2703,7 @@ impl Rooms { | ||||||
| 
 | 
 | ||||||
|         let words = search_string |         let words = search_string | ||||||
|             .split_terminator(|c: char| !c.is_alphanumeric()) |             .split_terminator(|c: char| !c.is_alphanumeric()) | ||||||
|  |             .filter(|s| !s.is_empty()) | ||||||
|             .map(str::to_lowercase) |             .map(str::to_lowercase) | ||||||
|             .collect::<Vec<_>>(); |             .collect::<Vec<_>>(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue