Creating the Form

The form is quite simple. It's your basic HTML form, with some added, hidden fields that help drive certain search engine characteristics.

You can download the form by clicking here and then follow along. It's a text file from this link, but you can cut and paste it as needed for your use.

If you compare the form setup with the search you see on the left-side of this page, you'll see where the fields come in, and where the Find It! button is displayed. Also, looking that the source in the file, you'll see that the fields are briefly explained:

  • mh is the Maximum number of hits you want to return.  For swynk.com, this value is 200.  Making the value too high can tax your server unnecessarily.  Too low and you won't return enough results to be meaningful.   This will take some tweaking on your part to determine the best value for your site.   (for you SQL folks out there, sounds like "Set rowcount=", doesn't it?)
  • sd is the column name that you want to use as the sort value.  In this case, we're calling out the hitcount column - indicating that we'll display the page with the most hits on the search first then order the results set from there, Descending (the "D" in the SD).   (SQL folks - this is equivalent to the "Order By...")
  • ae simply turns on enumeration for the results set.
  • ct points out where to find the catalog, or index database, that will be used.  This one's a bit tricky.  When you turn on the index server for a given web, you'll indicate where the index database should reside.  You MUST point this value to that location, or the index server will simply return NO results.  (this is the FROM database...)

Then, of course, it calls the ASP page that will take these values and query the server.  Note that it's using a GET type of form processing - more on this in just a minute, but it's imperitive that you use this if you're using our example pages.