# Are algorithms for searching text vs searching numbers fundamentally different?

I face this problem a lot while searching phone numbers and bank account numbers, when I do remember it partially.

I save a draft in gmail with the content I am mango. Then I search it, by entering just mango and it gets me to the draft.

But when I save a draft with some number such as 123987645 and try to search by entering 12398764 i.e just one character missing I fail to find it. Also I failed when I just typed 87645.

Out of curiosity I am asking are the algorithms for finding numbers and text fundamentally different? Or I am missing something?

• I edited your question to be ontopic here; nobody besides Google engineers know how they do it, but we can make educated guesses and talk about fundamentals. – Raphael Mar 24 '14 at 12:23
• @Raphael Thanks for editing. I was thinking that the screenshots will give some more clarity. – gpuguy Mar 24 '14 at 12:27
• I did not think so. All they provide is "proof" of Google behaving his way, but that is not as important here is would be on, say, Super User. – Raphael Mar 24 '14 at 12:31
• What is unexpected there ? In both cases you are matching exact words, be they formed of letters or digits, and the search engine returns those it finds !? I don't see different behaviors. – Yves Daoust Mar 25 '14 at 14:53

It is easy to preprocess texts so that finding whole words is fast. Well, looking for any substring is not that much slower (cf suffix trees) but it generates more data to store. Given the amount of data Google deals with, they might have a numbered dictionary and save tuples like (msg_id, position, word_id) (or similar)¹. Storing (matches for) all substrings would cause this data set to explode! (And don't even think about approximate search!)
You can try and verify this by searching not for mango but for ngo -- does it still find your message?