Configuration
Before you can search, you need to index your site. Use index.php
for local files indexing or spider.php for indexing via HTTP.
Edit file config.php to set several parameters. Most of them are selfdocumented
and does not require explanation.
$base_dir = ".";
- path to the directory, where your html files are located. If index.php located
in the same directory, leave this variable as is. Please note, that in all cases
you should use or relative path, or absolute, starting from file system root
(not from webserver root directory).
$base_url = "http://www.server.com/";
- URL of your site.
$site_size = 2;
- this variable controls database size and searching speed.
$file_ext = 'html txt htm shtml php';
- list of files extensions to be indexed.
$no_index_dir = 'img image temp tmp cgi-bin';
- directories, which should not be indexed.
$numbers = '0-9';
- during the indexing script removes all non alphabetic characters from page
and index what is left. Here you may add other characters, which should be indexed (such as numbers,
underscore sign and so on).
$use_selective_indexing = "NO";
- this option is useful for big sites with complex navigation, news postings
and other elements, which appear on every page and, probably, should not be
indexed. It allows to tell to the script, which parts of page should be cut
before indexing. Turn on this option ("YES") and edit following lines.
$no_index_strings = array(
"<!-- No index start 1 -->" => "<!-- No index end 1 -->",
"<!-- No index start 2 -->" => "<!-- No index end 2 -->",
);
Inside the quotes you need to write two strings. Everything placed between them
will be cut (note, if there are several occurrences of this strings
in file, each occurrence will be processed). For this purpose you may use
special marks, which divide different elements of design (Note, that slash and quotas
should be escaped - \/ ands \").
$cut_default_filenames = 'YES';
- this variable allows to cut default filenames (such as index.html) from URl in search results.
$INDEXING_SCHEME = 2;
- words indexing scheme. If indexing scheme equal "1", index is build on the whole word base.
Most fastest method, but script will find only words equal to the keyword.
When indexing scheme is "2", index is based on the beginning of each word.
Script will find all words, which begin with given keyword. For example, for query
"port" the words "portrait" and "portion" also will be found.
If indexing scheme equal "3" script put in index every substring with length 4.
It allows to find documents even in case when only middle part of word is entered as keyword.
In above case, for example, next words will be found: "important", "sport", "report" and so on.
$descr_size = 256;
- length of file description (as description may be used first lines
of file or content of "META description" tag).
There are many other parameters which are
self-documented in config.php file.
Spidering
Spidering script will use all parameters described above (except
$base_dir and
$base_url .
You have to set up just two additional variables.
$start_url
- List of starting URLs.
$allow_url
- Script will index only files within allowed servers.
If you need to exclude directory from indexing, use
$no_index_dir parameter (this parameter is one for all servers
in $allow_url list).
Template usage
Script uses template to control design of script output.
Template is placed in file "template.htm". It is standard HTML file, which can be
opened by every browser. You may look how your page will be displayed and
edit it.
Template consists of seven section: "header" and "footer" will be displayed
in every case; "results_header", "results" and "results_footer" are displayed
in case of succsessful search; "no_results" is used if no results are found;
"empty_query" will be displayed if there are no query supplied.
Each section divided by marks, like this:
<!-- RiSearch::header::start -->
You may edit everything between two dividers.
Template uses several predefined parameters, which will be replaced
by results of script work. Here is full list of parameters:
%query%
- query.
%search_time%
- time used by script to perform search.
%query_statistics%
- found words statistics (string like - "word1-n1 word2-n2").
%stpos%
- the starting number for results on this page.
%url%, %title%, %size%, %description%
- URL of found file, title, size and description.
%rescount%
- total number of found files.
%next_results%
- links to next pages with results.
|