Using search front-ends
=======================


Performing search
------------

Open your prefered frontend in Web browser:
http://your.web.server/path/to/search.cgi
or
http://your.web.server/path/to/search.php3
or
http://your.web.server/path/to/search.pl


To find something just type words you want to find and press SUBMIT button.
For example, "mysql odbc". You should not use quotes " in query,
they are written here only to divide a query from other text. mnoGoSearch
will find all documents that contain word "mysql" and/or word "odbc". 
Best documents having bigger weights will be displayed first.


Search parameters
-----------------

mnoGoSearch frontends support the following parameters given in CGI query 
string. You may use them in HTML form on search page.

q	text parameter with search query
ps	page size, number of search results displayed on one page,
	20 by default. Maximum page size is 100. This value does
	not allow to pass very big page sizes to avoid server overload
	and might be changed with MAX_PS definition in search.c.
np	page number, 0 by default (first page)
m	search mode. Currently "all","any" and "bool" values are supported.
wm	word match. You may use this parameter to choose word match type.
	There are "wrd", "beg", "end" and "sub" values that respectevely mean 
	whole word, word beginning, word ending and word substring match.
o	search result type. 0 by default. You may describe several template 
	sections for every part, for example "res". This allows to choose
	for example "Long" or "Short" search result output types. Up to 100
	different formats are allowed in the same template.
t	tag limit. Limits search through only documents with given tag.
	This parameter has the same effect with -t indexer option
cat	Category limit. Take a look into "categories.txt" for datails.
ul	URL limit, URL substring to limit search through subsection
	of database. It supports SQL % and _  LIKE wildcards. 
	This parameter has the same effect with -u indexer option.
	If relative URL is specified search.cgi inserts % signs before and 
	after "ul" value when compiled with SQL support. It allows to write 
	URL substring in HTML from to limit search, for example
	<OPTION VALUE="/manual/"> instead of VALUE="%/manual/%". When
	full URL with schema is specified search.cgi adds % sign only after
	this value. For example for <OPTION VALUE="http://localhost/"> 
	search.cgi will pass "http://localhost/%" in SQL LIKE comparison.
wf	Weight factors. It allow to change different document sections 
	weights at a search time. Should be passed in the form of hex number.
	Check the explanation below.
g	Language limit. Language abbreviation to limit search results by
	url.lang field.


Changing different document parts weights at search time
-------------------------------------------------------
  It is possible to pass "wf" HTML form variable to search.cgi
"wf" variable represents weight factors for specific document 
parts. Currently body,title,keywords,description,url are supported.

  To activate this feature please use degrees of 2 in *Weight commands of 
the indexer.conf. Let's imagine that we have these weights:

  URLWeight     1
  BodyWeight    2
  TitleWeight   4
  KeywordWeight 8 
  DescWeight    16

  As far as indexer uses bit OR operation for word weights when some
word presents several time in the same document, it is possible at search 
time to detect word appearance in different document parts. Word which 
appears only in the body will have 00000010 argegate weight (in binary notation).
Word used in all document parts will have 00011111 aggregate weight.

  "wf" value is a string of hex digits ABCDE. Each digit is a factor 
for corresponding bit in word weight. For the given above weights 
configuration:

      E is a factor for weight 1  (URLWeight     bit)
      D is a factor for weight 2  (BodyWeight    bit)
      C is a factor for weight 4  (TitleWeight   bit)
      B is a factor for weight 8  (KeywordWeight bit)
      A is a factor for weight 16 (DescWeight    bit)

Examples:

   wf=00001 will search through URLs only.
  
   wf=00100 will search through Titles only.

   wf=11100 will search through Title,Keywords,Desctription but not through 
             URL and Body.

   wf=F9421 will search through:
          Description with factor 15  (F hex)
          Keywords with factor 9
          Title with factor  4
          Body with factor 2
          URL with factor 1

  If "wf" variable is ommited in the query, original weight value is
taken to sort results. For a given above weight configuration it means
that document description has a most big weight 16.




Using different templates
-------------------------

It is often required to use several templates with the same
search.cgi. There are actually several ways to do it. They 
are given here in the order how search.cgi detects template
name. 

1. search.cgi checks environment variable UDMSEARCH_TEMPLATE. So you
can put a path to desired search template into this variable. 

2. search.cgi also supports Apache internal redirect. It checks
REDIRECT_STATUS and REDIRECT_URL environment variables. To activate 
this way of template usage you may add these lines in Apache srm.conf: 

AddType text/html .zhtml
AddHandler zhtml .zhtml
Action zhtml /cgi-bin/search.cgi

Put search.cgi into your /cgi-bin/ directory. Then put HTML template into
your site directory structure under any name with .zthml extension, for
example template.zhtml. Now you may open search page:
http://www.site.com/path/to/template.zhtml You may use any
unused extention instead of .zthml of course. 

3. If the above two ways fail, search.cgi opens a template which has
the same name with the script being executed using SCRIPT_NAME environment
variable. search.cgi will open a template ETC/search.htm, search1.cgi will
open ETC/search1.htm and so on, where ETC is mnoGoSearch /etc directory
(usually /usr/local/mnoGoSearch/etc). So, you can use the same search.cgi with
different templates without having to recompile it. Just create
one or several hard or symbolic links for search.cgi or copy it and put
corresponding search templates into /etc directory of mnoGoSearch installation.

  Take a look also into negotiation.txt

Advanced boolean search
-----------------------
If you want more advanced results you may use query language.
You should select "bool" match mode in the search from.

mnoGoSearch understands next boolean operators:

& - logical AND.
For example, "mysql & odbc". mnoGoSearch will find any URLs that 
contain both "mysql" and "odbc".

| - logical OR. For example "mysql|odbc". mnoGoSearch will find any URLs, 
that contain word "mysql" or word "odbc".

~ - logical NOT. For example "mysql & ~odbc". 
mnoGoSearch will find URLs that contain word "mysql" and do not contain
word "odbc" at the same time. Note that ~ just excludes given word from results.
Query "~odbc" will find nothing! 

() - group command to compose more complex queries.
For example "(mysql | msql) & ~postgres".
Query language is simple and powerful at the same time. Just consider 
query as usual boolean expression.


How search handles expired documents
----------------------------------------
Expired documents are still searchable with their old content.


