A. Vin
A. Vin

Reputation: 885

Querying a Database with Phone Number Comparison

I'm aware that it requires an external library (like libphonenumber...or simply PhoneNumberUtils) to compare two phone numbers when a variety of country exit/entry/local area codes are involved. Given this fact, I'm wondering how to efficiently query a database for all the phone numbers in a user's phone book if it's not an option to query for ALL phone numbers in the db then compare them afterwards (using PhoneNumberUtils) because there are simply too many numbers in the db. Is there a way to build that phone number comparison offered by libphonenumber/PhoneNumberUtils into the database query? Thanks for the help!

Upvotes: 1

Views: 283

Answers (1)

A. Vin
A. Vin

Reputation: 885

I finally worked out an answer to this in case anyone is interested. There isn't a way to build the phone number comparison into the database query - you need to parse all numbers beforehand and put them into a standard format (probably e164) using something like libphonenumber. Once they are all in a standard format in the database, querying against them is simple.

Upvotes: 2

Related Questions