Customizing AFSearch

AFSearch can be completely customized to suit your particular needs.  This section helps you modify the HTML output from the search query, and customize AFSearch for your distribution needs.

The easiest way to integrate AFSearch with your HTML files (including frames) is to call AFSearch as a local cgi script (similar to online cgi-bin scripts). This requires Localhost Mode.

LocalHost (CGI) Mode

AFSearch can integrate into your HTML page as a local cgi-bin program via LocalHost mode. This option is useful for a wide number of applications, such as creating a searchable e-book. CD-ROM developers and publishers can also allow their end users to search user manuals and the like found on the CD-ROM.

AFSearch's LocalHost mode allows it's powerful search features to be seamlessly integrated into all of your HTML files. Users who wish to find a specific topic of interest will be able to do so quickly and efficiently.

You can easily create your own search form by going to Index and selecting Generate Search Form to create a search template with the features you desire.  You may then edit the form to incorporate the HTML features you desire.

You must run AFSearch in Localhost on mode to enable it to be called as CGI.

LocalHost mode switch is accessible under Advanced Options, Set LocalHost On.  This will allow you to call AFSearch from your HTML forms, which behaves as if you were calling a CGI script.

To test whether local host mode has been switched on, type http://localhost:[Port Number]/GetForm in your browser.  A search form will be displayed if localhost has been enabled. Where the [Port Number] is the number you may set via [Settings | Set Local IP Address]

To auto launch your HTML files with AFSearch localhost cgi support, you can also use the command-line option:

AFSearch.exe -Setlocal:[Filename]

where [filename] is the name of the HTML file you want to open upon launching AFSearch.


Other methods of linking AFSearch to your HTML files are listed below:

Displaying Results in HTML Frames

If you are using LocalHost mode, there is no special procedures you need to take to show search results in a frame. All you need to do is to place the HTML code of the search form inside a frame, and the search results will be displayed in the same frame (similar to online CGI scripts).

If you are using AFSearch as an application, you can use the following methods To show the results of a search query within frames:

  1. Create a subdirectory named frame in the directory where AFSearch.exe is stored
  2. Create a file called frame.htm and any related files (such as images, etc.) in this directory.
  3. Insert the following command into the frame file to show the results:

frame src=result000.htm .

Once the above is done, AFSearch will copy the frame directory to the location when it stores result000.htm, and then tell the browser to load the frame file with the results displayed within that frame.

In frame.htm, to refer to files outside of the frame directory, use:

frame src=file:///c|[filename]

where file:///c| will be automatically replaced by the drive letter from where AFSearch is running.

The results of the search will be output to result000.htm, result001.htmresultnnn.htm.  This allows you to use the Back and Forward buttons to browse the search history.  If you choose not to save search histories, the results will always be saved to result000.htm.

You can also direct the target window of the search by using the Result Link option under the Advanced Options window.  This allows you to open the search query in a new window. AFSearch outputs its results to a file called result000.htm in the Windows default temporary directory. 

Changing Attributes in result000.htm
You can define a custom background and font for displaying your search query by editing the <body> HTML tag in the header.htm file.

Launching AFSearch from HTML Pages

AFSearch can be seamlessly integrated with your existing HTML files using local-host cgi mode.  If you prefer to let users launch AFSearch as an application from a hyperlink, you may use the follow method:

To take advantage of this, AFSearch must be setup as a helper application:

  1. Run AFSearch, click the Help menu and select Internet Explorer.  Then click Link Application.  (using command line parameter, AFSearch.exe -reg also works the same. )
  2. Insert the following command into the HTML file to allow the user to launch AFSearch:

<A HREF="temp.lsrh">Click here to search documents</A> .  

You will need to create a file called temp.lsrh in the same directory as the HTML file, but since its content is never used, this file may be left empty.

Netscape users can also use AFSearch as a helper application by:

Going to Options, General Options, Helpers, and defining AFSearch as the helper application for *.lsrh document types.

Internet Explorer users can setup a helper application by:

Going to View, Options, Program (tab), File Types, New Type, and selecting AFSearch as the helper application for *.lsrh document types.

Passing Search Results

You can pass search results to the browser using several different methods.  You can access all of the modes under the Help menu, and by selecting Internet Explorer.

LocalHost Mode:  Integrate AFSearch inside HTML pages to search directly within browser. This might be the easiest method if you need to distribute AFSearch to other users. [More info]

Window and DDE Mode:  This uses the standard Windows method to pass files to the browser.  Since different versions of Windows behave in different manners with browsers, these two methods allow the simplest and most direct method of passing search results.  This will pass results to the entire browser window, and does not allow targeting.  This is recommended if you are using AFSearch to search local files only, and have no need to integrate with existing HTML.

JavaScript Mode:  The JavaScript method allows you to define the target frame you want to pass results to (you can specify the target by using the [Result Window] option under [Advanced Options].  Be aware that this option will work only if Internet Explorer allows JavaScripting.  If you like call AFSearch within HTML files, we suggest you to use the LocalHost mode.

 

Compact Mode

Compact mode can be switched on or off via the View menu.  Switching compact mode off will prevent the search window from automatically shrinking to a small search box.

Customize Search Result Page

The header.htm and footer.htm files, if existed, will be merged into the search result page of every search query. This helps you to customize the look and feel of search result pages easily. For example, you can insert <body> tags, scripts, images into header.htm, so to change the background color, font size of your result pages.

AFSearch has a built-in editor allows you to customize these files to best suit your needs. You can find it under [Index]->[Editor], Choose Save from the editor to keep any changes, and Close to return to AFSearch.

Keyword Highlight

When using localhost mode, you can select to highlight the searched keyword in found documents. You can switch on/off keyword highlight via the View menu. You may also set the color of highlight using the [Set Highlight Color] function.