Match text

How does search find every document with two words in it? Lessons, a lab and the engines that use it.