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?

  • 1
    $\begingroup$ 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. $\endgroup$
    – Raphael
    Commented Mar 24, 2014 at 12:23
  • $\begingroup$ @Raphael Thanks for editing. I was thinking that the screenshots will give some more clarity. $\endgroup$
    – gpuguy
    Commented Mar 24, 2014 at 12:27
  • 1
    $\begingroup$ 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. $\endgroup$
    – Raphael
    Commented Mar 24, 2014 at 12:31
  • 1
    $\begingroup$ 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. $\endgroup$
    – user16034
    Commented Mar 25, 2014 at 14:53

1 Answer 1


There is no reason to assume that numbers and words are treated differently: for their servers, both are just strings. Different behaviour would be extra work and I don't see why that would be useful here.

There is one possible explanation for the behaviour you see: maybe they don't search for parts of words!

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?

  1. I'm quite sure Google does something far more clever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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