You could take a look at some of the search engine scripts at http://www.hotscripts.com/PHP/Scripts_and_Programs/Search_Engines/index.html
To build a search engine like either yahoo or google would take a massive amount of computing resources as they both search and index millions of webpages from millions of websites hosted around the world.