My understanding of the CONTAINS_TOKEN operator used in the CRM search API is that if a string has part of a substring matched, it should return that contact. I am using the api to find contacts based on their phone number. My problem is that when I search by phone numbers I get contacts with very similar phone numbers returned, but not actually the same. Is this a bug or am I misunderstanding how the CONTAINS_TOKEN operator works?
So, when searching for a phone number ((443) 443-9905) with CONTAINS_TOKEN operator, I am returned a contact with this phone number (443-310-9905) instead when I believe it shouldn’t return anything.
Is this a bug or am I misunderstanding how it should work? How does it actually work?
Apologies , I suggested the solution instead of answering your question!
Here is the answer to your questions -
No this is not a bug, and this is how I found this token search working -
If there are duplicate tokens in the search, they will be considered as one, so in our case 443 is duplicate, so it will not search for 2 occurrences of 443, instead, anyone 443 in the search will be considered as a match.
Special characters are escaped from the search so if you are searching for (443) you can get the results from $443! to
Except * all other special characters are considered as separator and escaped from the search, so you can get the same results from - (443!9905
Hi @himanshurauthan. Interesting.. I’ll keep that in mind for edge cases like these then since duplicate numbers can happen in phone numbers. Thank you for the explaination!