So why then make your own search engine?
To make money of course!
… and to become famous as the creator of the next big search engine or because as a programmer or engineer you like challenges. Making a search engine for the public Internet is tricky and if you’re like me you like to solve tricky problems.
The third application is a customized, high speed site search for you large
thousands of pages website. An indexed search engine will be a lot faster than
a full text search function and if Google’s site search isn’t flexible enough
for your site you can make your own search functionality.
THE BASICS OF SEARCH
The basis of any BIG search engine is a word to web page index, basically a long list of words and how well they relate to different web pages.
To make a search engine you have to do four things:
- Decide what pages to fetch and fetch them
- Parse out words, phrases and links from the page
- Give a score to every keyword or key phrase indicating how well the phrase relates to that pages and store the scores in the search engine index
- Provide a way for users to query the index and get a list of matching web pages
This is not hard for a seasoned programmer. It can be done in a day if you know regular expressions and have some experience with HTML and databases.
Now you have a working search engine, just add a lot of computers and hard drives and you’ll soon index all of the Internet. If you’re not prepared to go that far a one terabyte disk will hold an index of about 50 million pages.
HOW TO SCORE PAGES
After completing basic search functionality there’s a lot of work before anyone will want to use your new machine.
An index is not enough. What’s challenging is how to score pages to give the end user the search results that’s most relevant to his idea of what hi is searching for.
You’ll need to decide how much weight to put on keywords in the tile tag, description and main web page contents. To make good scoring you will also want to boost keywords found in the URL of the page and check the anchor text of inbound links.
Keeping track of inbound links is the most useful and most challenging of the above, you’ll need to keep a separate database table with info on all links between pages you index.
WHAT TO INDEX AND NOT TO INDEX
Other obstacles you will find when you start indexing real Internet content is the fact that there is wast amounts of useless junk floating around everywhere and eventually your index will become full of spam, affiliate pages, parked domains, work in progress homepages without content, link farms used by search engine optimizers, mirror sites using data feeds to create thousands of pages with product listings or other reproduced content etc, etc…
When indexing from the Internet you will have to find ways to filter out the junk content from what people are actually reading and searching for.
To start with you could limit how deep into sub directories you crawl, how many link hops from a domain index page you crawl and how many links per web page to allow.