Scanning books for indexes is fair use. Very notably providing access to those books to the public for free was not fair use...