#  This file is part of Siworin. Copyright © 2021 by Ruud Harmsen.
#
#  Siworin is a simple word indexer and local search engine. See
#  https://rudhar.com/sfreview/siworin/#siw04 and
#  https://rudhar.com/sfreview/siworin/toolsrc/siworin .
#
#  Siworin is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published
#  by the Free Software Foundation, either version 3 of the License,
#  or (at your option) any later version.
#
#  Siworin is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with Siworin.  If not, see <https://www.gnu.org/licenses/>.
#  *****************************************************************


# This is a sample config file for the Siworin local search
# engine. Written by Ruud Harmsen, September 2021.

# Keywords are case sensitive, and may be separated from
# their correspondending values by any combination of
# white space (i.e. tab or space) and ':' or '='.

# No config file needs to be present, source siworin-config.c
# provides defaults. Locations tried to find a config file are:
#
#  "./siworin.conf",
#  "/usr/local/siworin.conf",
#  "/usr/local/siworin/siworin.conf",
#  "/var/www/cgi-bin/siworin.conf",
#  "/var/www/cgi-bin/siworin/siworin.conf",
# in that order. Once a file is found, it is used, and all
# other files that may be present further on, are ignored.
# There is no need to specify all settings in a config file.
# Those that are present, will be used to overwrite the default
# values already set. What is not specified in the config file,
# remains at the default value.

# The following items are configurable:

# The maximum number of occurrences of a word for inclusion in
# the index. If there are too many, searching becomes trivial,
# so the word is suppressed. For example, having words like
# 'the', 'is', and 'and' in a search index makes no sense.
# See also https://rudhar.com/sfreview/siworin/siworin11.htm
word_max_occur		2000000

# Default is no (0). Setting this to 1 means an extra file
# will be written, containing lines with the number of times
# each word occurs, a tab, then that word. By sorting that
# file, you can find out which words are frequent and how
# often they occur. This may be helpful for setting
# word_max_occur above. 
write_words_freq	1

# The index files can be stored wherever you want. This is the
# default. This string will be used for appending extensions
# to it: .paths .pathoffs .words .wordoffs
files_prefix		/var/www/cgi-bin/siworin/siworin

# The clickable hyperlinks in the search results cannot use
# the internal paths of the files stored in the web server.
# They must be edited to turn them into valid URLs.
filepath_replace_this	/var/www/html/
filepath_replace_by	https://rudhar.com/

# The presentation of search results (title, CSS, etc.) should
# not be fixed. Here you can specify your own HTML header file.
head_html_file		/var/www/cgi-bin/siworin/siworin-head-html.htm

# The minimum number of search words (if specified) that should
# be present in a piece of HTML, to call it a match.
# See also https://rudhar.com/sfreview/siworin/siworin10.htm#id20210919
minim_match		  2
# The maximum distance (in bytes, including HTML tags) between those words.
maxim_dista		250

# The number of bytes of HTML to show before the first matching word,
# and after the last matching word. It can be a little less, in case an
# incomplete multibyte character, or an incomplete word is removed.
# See also https://rudhar.com/sfreview/siworin/siworin10.htm#id20210919
show_context_befor	 80
show_context_after	 80

# Search engine siworin is meant primarily to search HTML- and XML-like
# material. Then removing tags (what is between < and >) is useful.
# But siworin also works on e-mail files, e.g. in the mbx format used
# by Eudora. Because of the convention to start quoted lines with >,
# tag removal then has undesirable effects. Therefore it can be disabled,
# by setting this config switch to 1. The default is 0, i.e., do remove
# them.
# There is a separate switch for word separation (disabling will also
# index e-mail addresses between < and >), and context when displaying
# a result.
dont_remove_tags_wordsep	0
dont_remove_tags_context	0

# What is a word? Default is only alphabetic. Optionally,
# digits can be included, initially and subsequently
include_digits_initial		1
include_digits_subsequ		1

# Ranking parameters
#
# Having more matching words is better than fewer.
# This factor is added to the ranking for each matching word.
ranking_numwords	1.0
#
# Matching a rare word is better than matching a frequent word.
# This factor is divided by how often the word is in the index,
# and the result added to the ranking.
ranking_wordfreq	20.0
#
# Matching words that are close together are better than more distant words.
# This factor is divided by the distance in bytes between the matches,
# and the result added to the ranking.
ranking_worddist	10.0

# Sometimes there are very many searchresult, most of them hardly
# relevant. Many browsers take a long time loading them. It is
# often better to limit the number of results to display. 
# The default is: show all, which can also be encoded by 0 or -1 .
max_results_to_display	50

