Azure search SDK .NET searching for Phone number fields and formats

396 Views Asked by At

I am struggling to do searchs for like emails and phone numbers.

For instance we have a strig field in the index called PhoneNumber and it might have “(555) 555 -5555” but when I try to search 555-5555 or 555- I get no results. Another is CustomerEmail with “[email protected]’ and searching abs@ gives no results. I have seen tokens and analyzers but have not got it to work. Are there any examples on querying for emails or phone or special characters for .net sdk or github?

so a user can type in say '(816)555-5555' or '816 555-5555' and it would find 81655555555 in index?

1

There are 1 best solutions below

0
On

What analyzer configurations have you tried? It all comes down to how your documents and query terms are processed what you can learn about from the following article: How full text search works in Azure Search.

With the standard analyzer, the phone number (555) 555-5555 is tokenized to: 555, 555, 5555. Searching for 555-5555 should return it as your query becomes 555 OR 5555.

Same for the email address, [email protected] is tokenized to : abs, gmail.com. The @ character is removed from your query term so your query becomes abs what should find a match.

Could you share an example of your queries and index configuration?