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