Setting up the Frontend.

Frontend is a part of the search system installed on the server and performing search in the index file. There are three files necessary for the Frontend to work:

Typically the Frontend (file 'search' or 'search.exe') can be found in '/cgi-bin' directory and the web-server must have a permission to execute it. In the same directory there should be three files created by the Indexer. They are listed above.

The search word is delivered as a value of 'q' parameter. For example:

http://www.site.ru/cgi-bin/search?q=find+this

Hence, you can create search form according to you wish. The simplest variant looks like this:

<form action="/cgi-bin/search" method="get">
<input type="text" name="q" value="">
<input type="submit" value="Search">
</form>

Setting Up Search Results Templates.

You can create templates to set appearance of documents with search results. Some ready-to-use templates may be found at http://cn-software.com.

The template of the document with search results is stored in file 'search.htm', located in the directory of the search programme - 'search(.exe)'. The template is a plain HTML code consisting of four parts:

Do not mix up parts. The following special characters can be used in the template:


Parameters of Template "path"

You may use 'path' to set directory where index files are stored. 'path' may be specified in any part of template. In UNIX/Linux versions 'path' is set as follows:

<!-- path=/home/www/search/novg/ -->

and in Windows versions:

<!-- path=ñ:\www\search\novg\ -->

If "path" is not specified the programme will try directory where it is stored itself. In Example 1 "path" is not specified, but it is in Example 2.


Example 1

<HTML>
<HEAD>
<TITLE>Search results - %Q</TITLE>
</HEAD>
<BODY>
<table width=400 height=40 align=center bgcolor=#C0C0C0>
<form action=%F method=get><tr><td align=center>
<input type=text name=q size=40 maxlength=64 value="%Q">
<input type=submit value="Search">
</td></form></tr></table>
Documents found: %O
<!-- result start -->
<HR>
<UL>
<LI>%N. <a href=%U target=_new>%T</A>
    <small><font color=red>%S</font> [Relevancy: %R]</small>
<UL>
<LI>%E
<LI>%D
<LI>%C
<LI><a href=%U target=_new>%u</A>
</UL>
</UL>
<!-- result end -->
<!-- notfound start -->
<P><font color=red>%Q not found</font>
<!-- notfound end -->
</BODY>
</HTML>

Use of Several Templates

You may use several templates by setting 'template' in the search form. If 'template' is not specified, file 'search.htm' is used.

You may set a different name for a template. Name of a template must contain only upper or lower-case Latin letters and figures. It is not necessary to add '.htm' to the file name.

Correct variant:

<input type=hidden value='black'>
<input type=hidden value='red'>

Incorrect variant:

<input type=hidden value='../black'>
<input type=hidden value='red.htm'>

Below you can see an example of the template, allowing user to select an index, where search will be performed. Note - this result may be achieved by use of 'template' with template parameter path.


Example 2

<HTML>
<HEAD>
<TITLE>Search results - %Q</TITLE>
</HEAD>
<BODY>
<table width=400 height=40 align=center bgcolor=#C0C0C0>
<form action=%F method=get><tr><td align=center>
<input type=text name=q size=40 maxlength=64 value="%Q">
<select name=template>
<option value="novgorod">www.novgorod.ru
<option value="pskov">www.pskov.ru
<option value="sbp">www.spb.ru
</select>
<input type=submit value="search">
</td></form></tr></table>
Documents found: %O
<!-- result start -->
<HR>
<UL>
<LI>%N. <a href=%U target=_new>%T</A>
    <small><font color=red>%S</font> [Relevancy: %R]</small>
<UL>
<LI>%E
<LI>%D
<LI>%C
<LI><a href=%U target=_new>%u</A>
</UL>
</UL>
<!-- result end -->
<!-- path=/home/www/search/novg -->
<!-- notfound start -->
<P><font color=red>%Q not found</font>
<!-- notfound end -->
</BODY>
</HTML>
Up

Back | Contents | Proceed