Skip to content

Search

Search by Phone Number

There are two types of phone number search, fuzzy and partial. The difference is in the way the input is permuted prior to search. In general, fuzzy search returns more results, but partial search returns results that are closer to what the user entered. Let's illustrate from an example. Suppose the user enters 408-555-1234. In either search, non-numeric characters are stripped first.

Partial Search: 4085551234 is searched in the database for all records that have phone numbers that end in 4085551234. This includes entities with phone numbers such as 4085551234, 1-4085551234, 123-4085551234, etc.

Fuzzy Search: 4085551234 is permuted first by stripping 1-6 digits from the beginning of the sequence. If the resulting sequence is less than 6 digits long, it is dropped from the search. In this case, the search string set is 4085551234, 085551234, 85551234, 5551234, 551234. Any records in the database where the phone number ends in the string set is returned. The query results form fuzzy match includes results from the partial search and many more ambiguous results. For example, records with phone number such as 5105551234 would also be returned.

To designate the type of phone number search, specify the "match" field when entering the phone number in the search request body. E.g.,

1
{ "phone_number": { "value": "5551234", "match": "partial" } }

Match scheme is partial if the input string is 6 digits or fewer. For an input string 7 digits or more, the default behavior is fuzzy search if a match scheme is not specified.