ASP Search Facility for http://authors.aspalliance.com/brettb/default.asp

The following instructions describe how to add an ASP server-side Search Facility to your website. To get the search facility running, the following are required:

How it Works

The Website Utility extracts all of the words from the website and finds the most relevant pages in the website for each word. Common English words (e.g. got, like, then) are removed, as are words of one or two characters in length. Word rankings depend on many factors, including their distribution through the entire website and their distribution in the content of a specific page.

The Website Utility creates a Search Data ASP JScript Include File containing the rankings for each word and the most relevant pages for that word. It also creates the code required to parse the user's search query and find the most relevant pages matching their query.

Pages are sorted in search results according to their ranking for the particular word or words being searched for. The ranking scale goes from 0 to 99. Rank is higher for pages that most closely match the search term. In general, searching for words that are common on the site will produce search results with a lower rank than very specific words that occur on only one or two pages.

Important Note: For very large websites or more sophisticated searching, you may need to consider using a specialised server-based search solution such using Active Server Pages (ASP) to search Microsoft's Index Server. The Index Server Companion can be used to allow Index Server to search remote websites (and also to search more than one website simultaneously).

Search Form

The code for the search form is shown below:

Essential information: The search form needs a text box called TWUQuery. The form should use either the GET or POST method to submit to the search results page. To make it easier for users to search the website you might like to place the search form on all pages in the website.

Search Results

This page displays the search results. The ASP in this page could be incorporated into your own existing site, but ensure that the search Code and Data ASP JScript Include files are included. These include files are written in ASP using JScript, but they may be used in sites that make use of VBScript.

The code for the search results page is shown below:

Essential information: This page can of course be customised to fit in with the existing design of your website. If you want to display the search terms the user was searching for, then use this ASP code (assuming VBScript is the default scripting language): <%Response.Write(TWU_GetOriginalSearchQuery())%>. To display the search results, place this ASP code where you want the search results to appear: <%Response.Write(TWU_DisplaySearchResults(TWU_GetModifiedSearchQuery()))%>.

The search results page defines four ASP JScript variables that can be used to change the output:

If you have a basic knowledge of JScript (which is very similar to client-side JavaScript), it is also possible to change the display of the search results. This will involve editing the Search Code ASP JScript Include file.

Search Code JScript Include File

This ASP JScript file is required by the search results page. It contains the ASP JScript functionality for finding pages matching the user's search query. The file has been placed in the output folder (output\) with the filename TWUSearchCode_JScript.asp.

If you have a knowledge of ASP and JScript and want to change the way the search results are presented, then this file can be edited (be sure to take a backup first!). The JScript functions you may want to change are:

Search Data JScript Include File

This ASP JScript file is also required by the search results page. You should not need to edit this file! The file has been placed in the output folder (output\) with the filename TWUSearchData_JScript.asp.

Useful Tip: If you re-crawl a website to update the search facility, this is the only file that will have changed, so updating the search facility may be achieved by copying this file to the website.

Reporting Main Page

Report generated by The Website Utility 2.8