How to Put a Site Search Engine On Your Website
Install your own Search Engine Script or use a Remotely Hosted Search EngineHow to Put a Site Search Engine On Your Website
by Christopher Heng, thesitewizard.com
It never ceases to amaze me how many people use thesitewizard.com's internal search engine to look for specific articles. This is in spite of the fact that the entire index of articles is listed (at this time) on the main page (deliberately) so getting to the article is only one click away. Search engines provide a convenient way for people to locate things on your site using the terms which they are familiar with. When they can easily find what they want on your site, they are less likely to go away disappointed when the content is actually available on your site albeit under a different name.
If you don't have a search engine catering specifically to your site, it's time you considered adding one. There are three ways you can go about doing it.
1. Installing Your Own Search Engine Script
The ideal way, in my opinion, is to install your own Perl search engine script or (if you prefer) PHP search engine script. This requires you to have CGI access (or PHP as the case may be) on your web account. If you don't know how to write one, or can't be bothered to do so, you can get one of the numerous free search engine scripts and adapt it to your site. You can find a list of some free search engine Perl CGI scripts at http://www.thefreecountry.com/perlscripts/searchengines.shtml
In general there are two types of PHP or CGI search engine scripts. One will search your entire website for the relevant article each time your visitor invokes the search engine. The other creates an index of your site and only searches the index when the visitor uses the engine. The former is easier to configure and use for the newcomer, but quickly becomes sluggish when your website grows big. The latter is more efficient, but often requires you to remember to re-index your site each time you change your pages.
Installing your own search engine script has, at the very least, the following advantages:
You can customize your results page to your heart's content.
There are no third party advertisements (except those you place yourself and those from your web host, if you use a free web host).
You can re-index your site as many times as you need to.
Re-indexing your site does not increase your bandwidth utilization (for most scripts).
Disadvantages include:
You will need CGI access on your web server. If you're using a PHP search engine script, PHP access is needed.
You will need to muck around with the CGI script (or PHP script) in order to configure it. Search engine scripts typically need more configuration work than, say, a feedback form.
2. Using a Free or Commercial Third Party Search Engine Service
If installing a PHP or Perl CGI script is a problem, or if you prefer to let others handle the hassle (not really much of one actually) of maintaining the engine, you can use one of the many free or commercial search engine services. These services index your site for you and provide you with the HTML code to plug into your web pages. That's it. You have a working search engine for your site with little of the installation woes.
A list of Free Search Engine Remote Hosting Services may be obtained from http://www.thefreecountry.com/scripthosting/searchengines.shtml
Advantages of using the free search engine script remote hosting services include:
You do not need to have CGI or PHP access.
You don't have to worry about figuring out how to configure and upload Perl CGI scripts or PHP scripts.
Apart from configuring things like the frequency you want your site indexed and the appearance of your results page (through a convenient web interface), all you usually need with such services is to plug the supplied HTML code into your pages.
Disadvantages:
Most (if not all) free services impose banner advertising on the results page. Even if they don't, they often put a logo on the results page that points to their site. Depending on your needs, you may find that this detracts from the professionalism of your site. Many of the free services, however, have a paid option which will remove the third party advertising that the they impose with the free accounts.
The URL displayed in the location box of your visitors' browsers will not be your site's but the search engine's. However this can easily be circumvented by putting the results in an invisible (or visible) frame on your site.
Although most services allow you to customize your search results page, many do not provide the facility to completely control the output the way you might want to do to fit your site decor.
Some search engine hosting services impose a limit on the frequency you are allowed to re-index your site. Some only index your site at a fixed interval (eg, once a week) which means that the results shown may not be current. You should therefore read their documentation carefully before you sign up to make sure you get a service that suits your requirements.
Re-indexing your site typically requires the search engine to spider your site, thus adding to your website's bandwidth usage. If you are also using a commercial web host where you pay for your bandwidth, or if you use a free web host with limits on the bandwidth you are allowed, this might be a concern.
3. Using the Major Search Engines
Few people realise this, but you can actually use the major search engines like Google and Alta Vista as your site's search engine, free of charge.
To do this with Google, go to http://services.google.com/cobrand/free_select and complete the online form.
If you prefer to use Alta Vista, you will need to create a form modelled on the following code:
<form method="get"
action="http://www.altavista.com/cgi-bin/query">
<input type="hidden" name="pg" value="q" />
<input type="hidden" name="text" value="yes" />
<input type="hidden" name="what" value="web" />
<input type="hidden" name="fmt" value="" />
<input type="text" name="q"
value="%2Burl%3Awww.example.com " />
<input type="submit" value="Search" />
</form>
Change "www.example.com" to your own domain name. To search your site with that form, you simply type your query after the "+url:www.example.com " (where "www.example.com" is replaced by your real domain) text that appears in the the search entry box, and hit the "Search" button. This will cause the query to be sent to Alta Vista's engine. If you put a "target" attribute in the form tag, you can even direct the results so that it appears in a frame with your site URL still showing.
This method probably has little utility except for its novelty value. It has not only the disadvantages of using third party remote hosting services listed above, it has also the following additional disadvantages:
The re-indexing frequency of your site is even more limited than when using one of the CGI hosted services mentioned above. You have basically no control over the frequency that the major search engines index your site. This means that the search engines results will frequently be inaccurate - and if you add new pages to your site often, your site search engine will not be able to locate it.
The results page has the search engine's advertisements and formatting. You have even less control over the output than when using the third party search engine remotely hosted services.
Conclusion
Adding a search engine improves your site navigation. In allowing your visitors another means to locate items on your site, you are increasing the likelihood that they will find your site useful, bookmark your site, buy your goods/services, and so on.
With so many alternatives to adding a search engine to your site, most of them free, there is really little reason not to do so now (unless, of course your site is a one page site).
Copyright 2001-2003 by Christopher Heng. All rights reserved.