Add normalization for eds resolver
This commit is contained in:
@@ -164,6 +164,11 @@ impl ContactResolverBackend for EDSContactResolverBackend {
|
||||
format!("(is \"email\" \"{}\")", address)
|
||||
} else {
|
||||
let normalized_address = address
|
||||
.chars()
|
||||
.filter(|c| c.is_numeric())
|
||||
.collect::<String>();
|
||||
|
||||
let local_address = address
|
||||
.replace('+', "")
|
||||
.chars()
|
||||
.skip_while(|c| c.is_numeric() || *c == '(' || *c == ')')
|
||||
@@ -171,9 +176,10 @@ impl ContactResolverBackend for EDSContactResolverBackend {
|
||||
.chars()
|
||||
.filter(|c| c.is_numeric())
|
||||
.collect::<String>();
|
||||
|
||||
format!(
|
||||
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") )",
|
||||
address, normalized_address
|
||||
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") (is \"phone\" \"{}\"))",
|
||||
address, normalized_address, local_address
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user