I have a simple requirement to search based on phone numbers.

Phone numbers of users are stored in their user profiles.

The managed property for phone number is People:PhoneNumber

I have made a query rule to bring people in everything tab as a promoted results. Below is the rule.

PhoneNumber:"{subjectTerms}" OR PhoneNumber:"{subjectTerms}*" 

Following works fine:

  1. 1234567890
  2. 1234
  3. 123*

Following does not work

  1. 1234 56789

How can I allow phone numbers having space in it?

  • Do you have any user profiles where the phone number has a space in it? Search finds anything that contains whatever you type in. If anything contains "1234" it will find it. Same goes for if anything contains "1234 56789", if not, it doesn't find anything. – user2536 Apr 30 '15 at 11:39
  • Yes there is one user whose profile is set to contain 1234 56789. I ran the incremental crawl. I hope it does not need any full crawls as its just data change? – Asad Refai Apr 30 '15 at 11:43
  • Incremental crawl should be sufficient, yes. Try a full crawl nonetheless just to be sure. – user2536 Apr 30 '15 at 11:47
  • I am afraid this full crawl dint work totally. There are few users with spaces in phone number comes in search result, but not all. – Asad Refai Apr 30 '15 at 13:15

That is how crawl works.

If you have PhoneNumber in these format:

  1. 1234567890
  2. 1234 567890
  3. 123 4567 890
  4. 123 456 7890

When crawling, every sign or space " ", "-", "_", "(", ")" is like delimiter and it is putted in new place inside array.

For example: for 1. it will be array[0] with (1234567890), for 2. will be array[0 and 1] with (1234 and 567890) because space and for 3. and 4. it will be array[0, 1 and 2] because two spaces.

When you search for example PhoneNumber:"123*" you get all four.

If you search for ex. PhoneNumber:"1234*" you will get only two (1. and 2.).

If you search for ex. PhoneNumber:"12345*" you will get only one (1.) because only 1. contains all chars in one place.

If you search for ex. PhoneNumber:"123 456*" you will get two (3. and 4.).

I hope it's a little more clearly for you how crawl works.

| improve this answer | |
  • What if you search for PhoneNumber:" 456*"? And NOT PhoneNumber:" 456"? – Amadeo Gallardo Jul 10 '15 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.