Make like matching more forgiving by ignoring whitespace
This commit is contained in:
parent
3a42edb542
commit
0dbcf8d8d0
1 changed files with 3 additions and 2 deletions
|
@ -44,8 +44,9 @@ impl MpsFilterPredicate for FieldLikeFilter {
|
||||||
_ => Err(RuntimeMsg("Value is not type String".to_string())),
|
_ => Err(RuntimeMsg("Value is not type String".to_string())),
|
||||||
}?;
|
}?;
|
||||||
if let Some(field) = music_item_lut.field(&self.field_name) {
|
if let Some(field) = music_item_lut.field(&self.field_name) {
|
||||||
let field_str = field.as_str().to_lowercase();
|
let pattern = |c: char| c.is_whitespace() || c.is_control() || !c.is_alphanumeric();
|
||||||
Ok(field_str.contains(&variable.to_lowercase()))
|
let field_str = field.as_str().replace(pattern, "").to_lowercase();
|
||||||
|
Ok(field_str.contains(&variable.replace(pattern, "").to_lowercase()))
|
||||||
} else {
|
} else {
|
||||||
match self.field_errors {
|
match self.field_errors {
|
||||||
FieldFilterErrorHandling::Error => Err(RuntimeMsg(format!(
|
FieldFilterErrorHandling::Error => Err(RuntimeMsg(format!(
|
||||||
|
|
Loading…
Reference in a new issue