They scanned a bunch of books, and then allowed search results to hit them. They then only show a small context around the hit to avoid copyright infringement.
Bibliography:
- www.theatlantic.com/technology/archive/2017/04/the-tragedy-of-google-books/523320/ Torching the modern-day Library of Alexandria (2015) by James Somers
- The Google Story Chapter 21. A Virtual Library paints a good picture of the people involved