LanguagesPerlSite Search With AltaVista and HotBot

Site Search With AltaVista and HotBot

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


Use these to jump around or read it all…

[Set It Up]
[Search with AltaVista] [Search with HotBot]

One of the most asked questions is “How do I set it up so people can search my site?” I offered some answers in my database tutorial (
So, You Want A Searchable Database, Huh?
), including a JavaScript-driven search.

Well, now a little-known method is starting to be used more and more and I’m getting e-mail about it so a tutorial is in order. Here, you’ll learn how to use the AltaVista and HotBot search engines to search your site.


Set It Up

Yes, you heard right. You can use the honest-to-goodness AltaVista or HotBot search engines as your very own site search engine. Here’s how it works. You first submit all of your pages to one search engine or the other (or both if you want to set up both searches, but that seems like overkill to me). You’ll need to go to the search engine itself and follow their steps for submitting your pages.
     I mean submit them all, one right after the other. It may take a few days to get your sites into the system so they can be searched, but that’s not a concern. Once your pages are in the search engine, you’ll use the code below to set up a search from your page that limits AltaVista or HotBot to look only at pages listed in your domain or ISP account. Thus… only your pages will be searched. Cool, huh?
     The only real downfall is that when the results are posted, the user is taken off of your site and to the AltaVista or HotBot search engine. But then, of course, all the links that display point back to your site. It’s a small price to pay.
     Plus, since your pages are all registered with the search engine, they also have the ability to pop up during any normal search. Two birds, one stone.


Search with AltaVista

I’ll do the AltaVista code first. I’ve known the HotBot code for a while. It’s in the HTML Goodies book. I knew AltaVista had a method, but didn’t know the code until Denis Payne from the Impington Parish Council sent me what he had done. Thank you, Denis, you’re a gentleman.


Here’s the code
.

To apply it to your site, you need to make one change. This line:

<INPUT TYPE=”HIDDEN” name=q cols=0 rows=0 wrap=virtual
VALUE=”url:http://www.domain.com/your/site/“>

That denotes the domain and directory to be searched. For instance, your site is http://www.dogbreath.com/users/~joe. You would set up the line to read:

<INPUT TYPE=”HIDDEN” name=q cols=0 rows=0 wrap=virtual
VALUE=”url:http://www.dogbreath.com/users/~joe/“>

Notice the slash following the last directory, at the end of the URL. That tells AltaVista to search everything within http://www.dogbreath.com/users/~joe. You can also shortcut the typing by simply writing */users/~joe/ replacing the domain with a star. Either way will work.
     If you have a domain unto itself then put in the domain only ending it with a slash; it will search anything within the domain.
     One more thing: Notice how the code has a Thank You link back to AltaVista? Leave that in there. They’re nice enough to allow you to search using their site, offer a link back to help increase their traffic.


Search with HotBot

The code is very similar.
It looks like this
.

Again, there’s just the one line that needs to be altered:

<INPUT TYPE=”HIDDEN” NAME=”domain” VALUE=”www.domain.com/users/joe/“>

Note there’s no leading http://. Other than that, the same rules apply as to putting it in your domain. Again, there’s a courtesy link back to HotBot provided. Keep it.


That’s That

This is a great method for getting smaller sites into the search business. Good luck and happy searching!

 

Enjoy!

 

[Set It Up]
[Search with AltaVista] [Search with HotBot]

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories