How to match contacts that have a given phone number when the normalizedNumber is null in the database? #198
-
Hi everyone, when comparing phonenumbers, the given Can sanitizing on my own be achieved or is there a fix in the library needed? Besides that your library works flawless!
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Found my mistake. You have to use the |
Beta Was this translation helpful? Give feedback.
-
@wo-ist-henry thanks for creating this issue! You can certainly use For example, the query Therefore, I created issue #197 to add support in Once I make the code changes, your code should look like, suspend fun queryLocalSingleContact(searchText: String): Contact? =
Contacts(applicationContext)
.broadQuery()
.match(BroadQuery.Match.PHONE)
.wherePartiallyMatches(searchText)
.include(contactFieldsToInclude())
.orderBy(ContactsFields.LastUpdatedTimestamp.desc())
.limit(1)
.findWithContext()
.firstOrNull() If you are looking to match any contact data with your
As you already know, database values for You can certainly use As for using the |
Beta Was this translation helpful? Give feedback.
-
THANK YOU FOR THE COMPLIMENT ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️ |
Beta Was this translation helpful? Give feedback.
@wo-ist-henry thanks for creating this issue! You can certainly use
broadQuery()
with.whereAnyContactDataPartiallyMatches(searchText)
. However, if you are looking for contacts that match a specific phone number, then the currentBroadQuery
API may not return what you need.For example, the query
.whereAnyContactDataPartiallyMatches("718")
could match contacts that don't have matching phone numbers. It will match contacts with an address, email, organization, note, etc that contains "718" even if the contact does not have a phone number.Therefore, I created issue #197 to add support in
BroadQuery
to match only phone or email only. It will be included in the next release (0.2.0).Once I m…