This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[libcontacts] Use libphonenumber for number matching. Contributes to …
…JB#38835 This commit yields a significant improvement to how our phone number matching works. It gets rid of a lot of false positive matches. Previously we used a "minimized" number which we stored in the cache and used for matching. This lead to false positives between numbers for which the "minimized" number was the same when the full wasn't, for example when the area code of the number differs in only one digit. Examples of solved false positive matches: "+36 20 123 4567" and "+36 30 123 4567" were matched incorrectly. "+36 20 123 4567" and "+44 20 123 4567" were matched incorrectly. The new approach is to cache the full phone number and perform the matching between the full numbers using libphonenumber, which has a quite resilient algorithm for this. Local numbers and international direct dial (IDD) are still matched: Examples of local and IDD numbers that still work: "+36 20 123 4567" still matches "06 20 123 4567" (local) "+36 20 123 4567" still matches "00 36 70 381 0581" (IID) Limitations: We currently do NOT pass a default region code to libphonenumber, which means that some false positives can still occour in edge cases when a country code would be required to distinguish between the two numbers. This only happens when some numbers are supplied in a non-international format. Examples of remaining false positives: "06 20 123 4567" is a false positive match of "+1 0620 123 4567" "00 36 20 123 4567" is a false positive match of "+1 00 36 20 123 4567" We deem that the remaining false positives are unlikely enough that they don't matter in practice. If this becomes relevant, we will need to make it possible to pass a region code to the matching algorithm.
- Loading branch information
Timur Kristóf
committed
Feb 4, 2020
1 parent
2df678a
commit cdb0005
Showing
4 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters