Configuration file directives
This document lists the available configuration directives available in Swish-e.
What files Swish-e indexes and how they are indexed, and where the index is written can be controlled by a configuration file.
The configuration file is a text file composed of comments, blank lines, and configuration directives. The order of the directives is not important. Some directives may be used more than once in the configuration file, while others can only be used once (e.g. additional directives will overwrite preceding directives). Case of the directive is not important \*(-- you may use upper, lower, or mixed case.
Comments are any line that begin with a \*(L"#\*(R".
# This is a comment
As of 2.4.3 lines may be continued by placing a backslas as the last character on the line:
IgnoreWords \ am \ the \ foo
Directives may take more than one parameter. Enclose single parameters that include whitespace in quotes (single or double). Inside of quotes the backslash escapes the next character.
ReplaceRules append "foo bar" <- define "foo bar" as a single parameter
If you need to include a quote character in the value either use a backslash to escape it, or enclose it in quotes of the other type.
Backslashes also have special meaning in regular expressions.
FileFilterMatch pdftotext "'%p' -" /\.pdf$/
This says that the dot is a real dot (instead of matching any character). If you place the regular expression in quotes then you must use double-backslashes.
FileFilterMatch pdftotext "'%p' -" "/\\.pdf$/"
Swish-e will convert the double backslash into a single backslash before passing the parameter to the regular expression compiler.
Commented example configuration files are included in the conf directory of the Swish-e distribution.
Some command line arguments can override directives specified in the configuration file. Please see also the SWISH-RUN for instructions on running Swish-e, and the SWISH-SEARCH page for information and examples on how to search your index.
The configuration file is specified to Swish-e by the \*(C`-c\*(C' switch. For example,
swish-e -c myconfig.conf
You may also split your directives up into different configuration files. This allows you to have a master configuration file used for many different indexes, and smaller configuration files for each separate index. You can specify the different configuration files when running from the command line with the \*(C`-c\*(C' switch (see SWISH-RUN), or you may include other Configuration file with the IncludeConfigFile directive below.
Typically, in a configuration file the directives are grouped together in some logical order \*(-- that is, directives that control the source of the documents would be grouped together first, and directives that control how each document is filtered or its words index in another group of directives. (The directives listed below are grouped in this order).
The configuration file directives are listed below in these groups:
\*(L"Administrative Headers Directives\*(R" \*(-- You may add administrative information to the header of the index file.
\*(L"Document Source Directives\*(R" \*(-- Directives for selecting the source documents and the location of the index file.
\*(L"Document Contents Directives\*(R" \*(-- Directives that control how a document content is indexed.
\*(L"Directives for the File Access method only\*(R" \*(-- These directives are only applicable to the File Access indexing method.
\*(L"Directives for the \s-1HTTP\s0 Access Method Only\*(R" \*(-- Likewise, these only apply to the \s-1HTTP\s0 Access method.
\*(L"Directives for the prog Access Method Only\*(R" \*(-- These only apply to the prog Access method.
\*(L"Document Filter Directives\*(R" \*(-- This is a special section that describes using document filters with Swish-e.
\$1
AbsoluteLinks [yes|NO]
BeginCharacters *string of characters*
BumpPositionCounterCharacters *string*
Buzzwords [*list of buzzwords*|File: path]
CompressPositions [yes|NO]
ConvertHTMLEntities [YES|no]
DefaultContents [TXT|HTML|XML|TXT2|HTML2|XML2|TXT*|HTML*|XML*]
Delay *seconds*
DontBumpPositionOnEndTags *list of names*
DontBumpPositionOnStartTags *list of names*
EnableAltSearchSyntax [yes|NO]
EndCharacters *string of characters*
EquivalentServer *server alias*
ExtractPath *metaname* [replace|remove|prepend|append|regex]
FileFilter *suffix* *program* [options]
FileFilterMatch *program* *options* *regex* [*regex* ...]
FileInfoCompression [yes|NO]
FileMatch [contains|is|regex] *regular expression*
FileRules [contains|is|regex] *regular expression*
FuzzyIndexingMode [NONE|Stemming|Soundex|Metaphone|DoubleMetaphone]
FollowSymLinks [yes|NO]
HTMLLinksMetaName *metaname*
IgnoreFirstChar *string of characters*
IgnoreLastChar *string of characters*
IgnoreLimit *integer integer*
IgnoreMetaTags *list of names*
IgnoreNumberChars *list of characters*
IgnoreTotalWordCountWhenRanking [YES|no]
IgnoreWords [*list of stop words*|File: path]
ImageLinksMetaName *metaname*
IncludeConfigFile
IndexAdmin *text*
IndexAltTagMetaName *tagname*|as-text
IndexComments [yes|NO]
IndexContents [TXT|HTML|XML|TXT2|HTML2|XML2|TXT*|HTML*|XML*] *file extensions*
IndexDescription *text*
IndexDir [URL|directories or files]
IndexFile *path*
IndexName *text*
IndexOnly *list of file suffixes*
IndexPointer *text*
IndexReport [0|1|2|3]
MaxDepth *integer*
MaxWordLimit *integer*
MetaNameAlias *meta name* *list of aliases*
MetaNames *list of names*
MinWordLimit *integer*
NoContents *list of file suffixes*
obeyRobotsNoIndex [yes|NO]
ParserWarnLevel [0|1|2|3]
PreSortedIndex *list of property names*
PropCompressionLevel [0-9]
PropertyNameAlias *property name* *list of aliases*
PropertyNames *list of meta names*
PropertyNamesCompareCase *list of meta names*
PropertyNamesIgnoreCase *list of meta names*
PropertyNamesNoStripChars *list of meta names*
PropertyNamesDate *list of meta names*
PropertyNamesNumeric *list of meta names*
PropertyNamesMaxLength integer *list of meta names*
PropertyNamesSortKeyLength integer *list of meta names*
ReplaceRules [replace|remove|prepend|append|regex]
ResultExtFormatName name -x format string
SpiderDirectory *path*
StoreDescription [\s-1XML\s0 <tag>|HTML <meta>|TXT size]
"SwishProgParameters *list of parameters*
SwishSearchDefaultRule [<AND-WORD>|<or-word>]
TmpDir *path*
TranslateCharacters [*string1 string2*|:ascii7:]
TruncateDocSize *number of characters*
UndefinedMetaTags [error|ignore|INDEX|auto]
UndefinedXMLAttributes [DISABLE|error|ignore|index|auto]
UseStemming [yes|NO]
UseSoundex [yes|NO]
UseWords [*list of words*|File: path]
WordCharacters *string of characters*
XMLClassAttributes *list of \s-1XML\s0 attribute names* These configuration directives control the general behavior of Swish-e.
This directive can be used to include configuration directives located in another file. IncludeConfigFile /usr/local/swish/conf/site_config.config
This is how detailed you want reporting while indexing. You can specify numbers 0 to 3. 0 is totally silent, 3 is the most verbose. The default is 1. This may be overridden from the command line via the \*(C`-v\*(C' switch (see SWISH-RUN).
Sets the error level when using the libxml2 parser for \s-1XML\s0 and \s-1HTML\s0. libxml2 will point out structural errors in your documents. 0 = no report 1 = fatal errors 2 = errors 3 = warnings Currently (as of 2.4.4 - early 2005) libxml2 only reports errors at level 2. The default as of 2.4.4 is \*(L"2\*(R" which should report any errors that might indicate a problem parsing a document. The exception to this is \s-1UTF-8\s0 to Latin-1 conversion errors are reported at level 3 (changed from 1 in 2.4.4). Although these errors indicate a problem indexing text, they are only reported at level 3 because they can be very common. It is recommended that you index at ParserWarnLevel 3 when first starting out to see what errors and warnings are reported. Then reduce the level when you understand what documents are causing parsing problems and why.
Index file specifies the location of the generated index file. If not specified, Swish-e will create the file index.swish-e in the current directory. IndexFile /usr/local/swish/site.index
When enabled, Swish-e will not index any \s-1HTML\s0 file that contains: <meta name="robots" content="noindex"> The default is to ignore these meta tags and index the document. This tag is described at http://www.robotstxt.org/wc/exclusion.html. Note: This feature is only available with the libxml2 \s-1HTML\s0 parser. Also, if you are using the libxml2 parser (\s-1HTML2\s0 and \s-1XML2\s0) then you can use the following comments in your documents to prevent indexing: <!-- SwishCommand noindex --> <!-- SwishCommand index --> and/or these may be used also: <!-- noindex --> <!-- index --> For example, these are very helpful to prevent indexing of common headers, footers, and menus.
\s-1NOTE\s0: This following items are currently not available. These items require Swish-e to parse the configuration file while searching.
\s-1NOTE\s0: This following item is currently not available. Enable alternate search syntax. Allows the usage of a basic \*(L"Altavista(c)\*(R", \*(L"Lycos(c)\*(R", etc. like search syntax. This means a search query can contain \*(L"+\*(R" and \*(L"-\*(R" as syntax parameter. Example: swish-e -w "+word1 +word2 -word3 word4 word5" "+" = following word has to be in all found documents "-" = following word may not be in any document found " " = following word will be searched in documents
\s-1NOTE\s0: This following item is currently not available. Using this config directive you can change the boolean search operators of Swish-e, e.g. to adapt these to your language. The default is: \s-1AND\s0 \s-1OR\s0 \s-1NOT\s0 Example (german): SwishSearchOperators UND ODER NICHT
\s-1NOTE\s0: This following item is currently not available. \*(C`SwishSearchDefaultRule\*(C' defines the default Boolean operator to use if none is specified between words or phrases. The default is \*(C`AND\*(C'. The word you specify must match one of the available \*(C`SwishSearchOperators\*(C'. Example: SwishSearchOperators UND ODER NICHT # Make it act like a web search engine SwishSearchDefaultRule ODER
\s-1NOTE\s0: This following item is currently not available. The output of Swish-e can be defined by specifying a format string with the \*(C`-x\*(C' command line argument. Using \*(C`ResultExtFormatName\*(C' you can assign a predefined format string to a name. Examples: ResultExtFormatName moreinfo "%c|%r|%t|%p|<author>|<publishyear>\n" Then when searching you can specify the format string's name swish-e ... -x moreinfo ... See the \*(C`-x\*(C' switch in SWISH-RUN for more information about output formats. Swish-e stores configuration information in the header of the index file. This information can be retrieved while searching or by functions in the Swish-e C library. There are a number of fields available for your own use. None of these fields are required:
These variables specify information that goes into index files to help users and administrators. IndexName should be the name of your index, like a book title. IndexDescription is a short description of the index or a \s-1URL\s0 pointing to a more full description. IndexPointer should be a pointer to the original information, most likely a \s-1URL\s0. IndexAdmin should be the name of the index maintainer and can include name and email information. These values should not be more than 70 or so characters and should be contained in quotes. Note that the automatically generated date in index files is in D/M/Y and 24-hour format. Examples: IndexName "Linux Documentation" IndexDescription "This is an index of /usr/doc on our Linux machine." IndexPointer http://localhost/swish/linux/index.html IndexAdmin webmaster These directives control what documents are indexed and how they are accessed. See also Directives for the File Access method only and Directives for the \s-1HTTP\s0 Access Method Only for directives that are specific to those access methods.
IndexDir defines the source of the documents for Swish-e. Swish-e currently supports three file access methods: File system, \s-1HTTP\s0 (also called spidering), and prog for reading files from an external program. The \*(C`-S\*(C' command line argument is used to select the file access method. swish-e -c swish.config -S fs - file system swish-e -c swish.config -S http - internal http spider swish-e -c swish.config -S prog - external program of any type For the fs method of access IndexDir is a space-separated list of files and directories to index. Use a forward slash as the path separator in \s-1MS\s0 Windows. For the http method the IndexDir setting is a list of space-separated URLs. For the prog method the IndexDir setting is a list of space-separated programs to run (which generate documents for swish to index). You may specify more than one IndexDir directive. Any sub-directories of any listed directory will also be indexed. Note: While processing directories, Swish-e will ignore any files or directories that begin with a dot (\*(L".\*(R"). You may index files or directories that begin with a dot by specifying their name with \*(C`IndexDir\*(C' or \*(C`-i\*(C'. Examples: # Index this directory an any subdirectories IndexDir /usr/local/home/http # Index the docs directory in current directory IndexDir ./docs # Index these files in the current directory IndexDir ./index.html ./page1.html ./page2.html # and index this directory, too IndexDir ../public_html For the \s-1HTTP\s0 method of access specify the \s-1URL\s0's from which you want the spidering to begin. Example: IndexDir http://www.my-site.com/index.html IndexDir http://localhost/index.html Obviously, using the \s-1HTTP\s0 method to index is much slower than indexing local files. Be well aware that some sites do not appreciate spidering and may block your \s-1IP\s0 address. You may wish to contact the remote site before spidering their web site. More information about spidering can be found in Directives for the \s-1HTTP\s0 Access Method Only below. For the prog method of access IndexDir specifies the path to the program(s) to execute. The external program must correctly format the documents being passed back to Swish-e. Examples of external programs are provided in the prog-bin directory. IndexDir ./myprogram.pl See prog for details. Note: Not all directives work with all methods.
Files with these suffixes will not have their contents indexed, but will have their path name (file name) indexed instead. If the file's type is \s-1HTML\s0 or \s-1HTML2\s0 (as set by \*(C`IndexContents\*(C' or \*(C`DefaultContents\*(C') then the file will be parsed for a \s-1HTML\s0 title and that title will be indexed. Note that you must set the file's type with \*(C`IndexContents\*(C' or \*(C`DefaultContents\*(C': \*(C`.html\*(C' and \*(C`.htm\*(C' are \s-1NOT\s0 type \s-1HTML\s0 by default. For example: IndexContents HTML* .htm .html If a title is found, it will still be checked for \*(C`FileRules title\*(C', and the file will be skipped if a match is found. See \*(C`FileRules\*(C'. If the file's type is not \s-1HTML\s0, or it is \s-1HTML\s0 and no title is found, then the file's path will be indexed. For example, this will allow searching by image file name. NoContents .gif .xbm .au .mov .mpg .pdf .ps Note: Using this directive will not cause files with those suffixes to be indexed. That is, if you use \*(C`IndexOnly\*(C' to limit the types of files that are indexed, then you must specify in \*(C`IndexOnly\*(C' the same suffixes listed in \*(C`NoContents\*(C'. This does not work: # Wrong! IndexOnly .htm .html NoContents .gif .xbm .au .mov .mpg .pdf .ps A \*(C`-S prog\*(C' program may set the \*(C`No-Contents:\*(C' header to enable this feature for a specific document (although it would be smarter for the \*(C`-S prog\*(C' program to simply only send the pathname or title to be indexed.
ReplaceRules allows you to make changes to file pathnames before they're indexed. These changed file names or URLs will be returned in search results. For example, you may index your files locally (with the File system indexing method), yet return a \s-1URL\s0 in search results. This directive can be used to map the file names to their respective URLs on your web server. There are five operations you can specify: replace, append, remove, prepend, and regex They will parse the pathname in the order you've typed these commands. This directive uses C library regex.h regular expressions. replace "the string you want replaced" "what to change it to" remove "a string to remove" prepend "a string to add before the result" append "a string to add after the result" regex "/search string/replace string/options" Remember, quotes are needed if an expression contains white space, and backslashes have special meaning. Regex is an Extended Regular Expression. The first character found is the delimiter (but it's not smart enough to use matched chars such as [], (), and {}). The replace string may use substitution variables: $0 the entire matched (sub)string $1-$9 returns patterns captured in "(" ")" pairs $` the string before the matched pattern $' the string after the matched pattern The options change the behavior of expression: i ignore the case when matching g repeat the substitution for the entire pattern Examples: ReplaceRules replace testdir/ anotherdir/ ReplaceRules replace [a-z_0-9]*_m.*\.html index.html ReplaceRules remove testdir/ ReplaceRules prepend http://localhost/ ReplaceRules append .html ReplaceRules regex !^/web/(.+)/!http://$1.domain.com/! replaces a file path: /web/search/foo/index.html with http://search.domain.com/foo/index.html ReplaceRules regex #^#http://localhost/www# ReplaceRules prepend http://localhost/www (same thing) # Remove all extensions from C source files ReplaceRules remove .c # ERROR! That "." is *any char* ReplaceRules remove \.c # much better... ReplaceRules remove "\\.c" # if in quotes you need double-backslash! ReplaceRules remove "\.c" # ERROR! "\." -> "." and is *any char*
The \*(C`IndexContents\*(C' directive assigns one of Swish-e's document parsers to a document, based on the its extension. Swish-e currently knows how to parse \s-1TXT\s0, \s-1HTML\s0, and \s-1XML\s0 documents. The \s-1XML2\s0, \s-1HTML2\s0, and \s-1TXT2\s0 parsers are currently only available when Swish-e is configured to use libxml2. You may use XML*, HTML*, and TXT* to select the parser automatically. If libxml2 is installed then it will be used to parse the content. Otherwise, Swish-e's internal parsers will be used. Documents that are not assigned a parser with \*(C`IndexContents\*(C' will, by default, use the \s-1HTML2\s0 parser if libxml2 is installed, otherwise will use Swish-e's internal \s-1HTML\s0 parser. The \*(C`DefaultContents\*(C' directive may be used to assign a parser to documents that do not match a file extension defined with the \*(C`IndexContents\*(C' directive. Example: IndexContents HTML* .htm .html .shtml IndexContents TXT* .txt .log .text IndexContents XML* .xml HTML* is the default type for all files, unless otherwise specified (and this default can be changed by the DefaultContents directive. Swish-e parses titles from \s-1HTML\s0 files, if available, and keeps track of the context of the text for context searching (see \*(C`-t\*(C' in SWISH-RUN). If using filters (with the \*(C`FileFilter\*(C' directive) to convert documents you should include those extensions, too. For example, if using a filter to convert .pdf to .html, you need to tell Swish-e that .pdf should be indexed by the internal \s-1HTML\s0 parser: FileFilter .pdf pdf2html IndexContent HTML .pdf See also Document Filter Directives. Note: Some of this may be changed in the future to use content-types instead of file extensions. See \s-1SWISH-3\s0.0
This sets the default parser for documents that are not specified in IndexContents. If not specified the default is \s-1HTML\s0. The \s-1XML2\s0, \s-1HTML2\s0, and \s-1TXT2\s0 parsers are currently only available when Swish-e is configured to use libxml2. You may use XML*, HTML*, and TXT* to select the parser automatically. If libxml2 is installed then it will be used to parse the content. Otherwise, Swish-e's internal parsers will be used. Example: DefaultContents HTML The \*(C`DefaultContents\*(C' directive should be used when spidering, as \s-1HTML\s0 files may be returned without a file extension (such as when requesting a directory and the default index.html is returned).
** This directive is currently not supported ** Setting FileInfoCompression to \*(C`yes\*(C' will compress the index file to save disk space. This may result in longer indexing times. The default is \*(C`no\*(C'. Also see the \*(C`-e\*(C' switch in SWISH-RUN for saving \s-1RAM\s0 during indexing. These directives control what information is extracted from your source documents, and how that information is made available during searching.
\s-1ASCII\s0 entities can be converted automatically while indexing documents of type \s-1HTML\s0 (not for \s-1HTML2\s0). For performance reasons you may wish to set this to \*(C`no\*(C' if your documents do not contain \s-1HTML\s0 entities. The default is \*(C`yes\*(C'. If \*(C`ConvertHTMLEntities\*(C' is set \*(C`no\*(C' the entities will be indexed without conversion. \s-1NOTE:\s0 Entities within \s-1XML\s0 files and files parsed with libxml2 (\s-1HTML2\s0) are converted regardless of this setting.
\s-1META\s0 names are a way to define \*(L"fields\*(R" in your \s-1XML\s0 and \s-1HTML\s0 documents. You can use the \s-1META\s0 names in your queries to limit the search to just the words contained in that \s-1META\s0 name of your document. For example, you might have a \s-1META\s0 tagged field in your documents called \*(C`subjects\*(C' and then you can search your documents for the word \*(L"foo\*(R" but only return documents where \*(L"foo\*(R" is within the \*(C`subjects\*(C' \s-1META\s0 tag. swish-e -w subjects=foo (See also the \*(C`-t\*(C' switch in SWISH-RUN for information about context searching in \s-1HTML\s0 documents.) The MetaNames directive is a space separated list. For example: MetaNames meta1 meta2 keywords subjects You may also use \*(C`UndefinedMetaTags\*(C' to specify automatic extraction of meta names from your \s-1HTML\s0 and \s-1XML\s0 documents, and also to ignore indexing content of meta tags. \s-1META\s0 tags can have two formats in your \s-1HTML\s0 source documents: <META NAME="meta1" CONTENT="some content"> and (if using the HTML2/libxml2 parser) <meta1> some content </meta1> But this second version is invalid \s-1HTML\s0, and will generate a warning if ParserWarningLevel is set (libxml2 only). And in \s-1XML\s0 documents, use the format: <meta1> Some Content </meta1> Then you can limit your search to just \s-1META\s0 meta1 like this: swish-e -w 'meta1=(apples or oranges)' You may nest the \s-1XML\s0 and the start/end tag versions: <keywords> <tag1> some content </tag1> <tag2> some other content </tag2> <keywords> Then you can search in both tag2 and tag2 with: swish-e -w 'keywords=(query words)' Swish-e indexes all text as some metaname. The default is \*(C`swishdefault\*(C', so these two queries are the same: swish-e -w foo swish-e -w swishdefault=foo When indexing \s-1HTML\s0 Swish-e indexes the \s-1HTML\s0 title as default text, so when searching Swish-e will find matches in both the \s-1HTML\s0 body and the \s-1HTML\s0 title. Swish also, by default, indexes content of meta tags. So: swish-e -w foo will find \*(L"foo\*(R" in the body, the title, or any meta tags. Currently, there's no way to prevent Swish-e from indexing the title contents along with the body contents, but see \*(C`UndefinedMetaTags\*(C' for how to control the indexing of meta tags. If you would like to search just the title text, you may use: MetaNames swishtitle This will index the title text separately under the built-in swish internal meta name \*(L"swishtitle\*(R". You may then search like swish-e -w foo -- search for "foo" in title, body (and undefined meta tags) swish-e -w swishtitle=foo -- search for "foo" in title only In addition to swishtitle, you can limit searches to documents' path with: MetaNames swishdocpath Then to search for \*(L"foo\*(R" but also limit searches to documents that include \*(L"manual\*(R" or \*(L"tutorial\*(R" in their path: swish-e -w foo swishdocpath=(manual or tutorial) See also \*(C`ExtractPath\*(C'.
MetaNameAlias assigns aliases for a meta name. For example, if your documents contain meta tags \*(L"description\*(R", \*(L"summary\*(R", and \*(L"overview\*(R" that all give a summary of your documents you could do this: MetaNames summary MetaNameAlias summary description overview Then all three tags will get indexed as meta tag \*(L"summary\*(R". You can then search all the fields as: -w summary=foo The Alias work at search time, too. So these will also limit the search to the \*(L"summary\*(R" meta name. -w description=foo -w overview=foo
You can assign a bias to metanames that will affect how ranking is calculated. The range of values is from -10 to +10, with zero being no bias. MetaNamesRank 4 subject MetaNamesRank 3 swishdefault MetaNamesRank 2 author publisher MetaNamesRank -5 wrongwords This feature is still considered experimental. If you use it, please send feedback to the discussion list.
Allows indexing of \s-1HTML\s0 links. Normally, \s-1HTML\s0 links (href tags) are not indexed by Swish-e. This directive defines a metaname, and links will be indexed under this meta name. Example: HTMLLinksMetaName links Now, to limit searches to files with a link to \*(L"home.html\*(R" do this: -w links='"home.html"' The double quotes force a phrase search. To make Swish-e index links as normal text, you may use: HTMLLinksMetaName swishdefault This feature is only available with the libxml2 \s-1HTML\s0 parser.
Allows indexing of image links under a metaname. Normally, image URLs are not indexed. Example: ImagesLinksMetaName images Now, if you would like to find pages that include a nice image of a beach: -w images='beach' To make Swish-e index links as normal text, you may use: ImageLinksMetaName swishdefault This feature is only available with the libxml2 \s-1HTML\s0 parser.
Allows indexing of images <\s-1IMG\s0> \s-1ALT\s0 tag text. Specify either a tag name which will be used as a metaname, or the special text \*(L"as-text\*(R" which says to index the \s-1ALT\s0 text as if it were plain text at the current location. For example, by specifying a tag name: IndexAltTagMetaName bar would make this markup: <foo> <img src="/someimage.png" alt="Alt text here"> </foo> appear like <foo> <bar>Alt text here</bar> </foo> Then the normal rules (\*(C`MetaNames\*(C' and \*(C`PropertyNames\*(C') apply to how that text is indexed. If you use the special tag \*(L"as-text\*(R" then <foo> <img src="/someimage.png" alt="Alt text here"> </foo> simply becomes <foo> Alt text here </foo> This feature is only available when using the libxml2 parser (\s-1HTML2\s0 and \s-1XML2\s0).
If this is set true then Swish-e will attempt to convert relative URIs extracted from \s-1HTML\s0 documents for use with \*(C`HTMLLinksMetaName\*(C' and \*(C`ImageLinksMetaName\*(C' into absolute URIs. Swish-e will use any <\s-1BASE\s0> tag found in the document, otherwise it will use the file's pathname. The pathname used will be the pathname *after* \*(C`ReplaceRules\*(C' has been applied to the document's pathname. For example, say you wish to index image links under the metaname \*(L"images\*(R". ImageLinksMetaName images If an image is located in http://localhost/vacations/france/index.html and \*(C`AbsoluteLinks\*(C' is set to no, then a image within that document: <img src="beach.jpeg"> will only index \*(L"beach.jpeg\*(R". But, if you want more detail when searching, you can enable \*(C`AbsoluteLinks\*(C' and Swish-e will index \*(L"http://localhost/vacations/france/beach.jpeg\*(R". You can then look for images of beaches, but only in France: -w images=(beach and france) This also means you can search for any images within France: -w images=(france) This feature is only available with the libxml2 \s-1HTML\s0 parser.
This directive defines the behavior of Swish-e during indexing when a meta name is found but is not listed in MetaNames. There are four choices:
If a meta name is found that is not listed in MetaNames then indexing will be halted and an error reported.
The contents of the meta tag are ignored and not indexed unless a metaname has been defined with the \*(C`MetaNames\*(C' directive.
The contents of the meta tag are indexed, but placed in the main index unless there's an enclosing metatag already in force. This is the default.
This method create meta tags automatically for \s-1HTML\s0 meta names and \s-1XML\s0 elements. Using this is the same as specifying all the meta names explicitly in a MetaNames directive.
This is similar to \*(C`UndefinedMetaTags\*(C', but only applies to \s-1XML\s0 documents (parsed with libxml2). This allows indexing of attribute content, and provides a way to index the content under a metaname. For example, \*(C`UndefinedXMLAttributes\*(C' can make <person age="23"> John Doe </person> look like the following to swish: <person> <person.age> 23 </person.age> John Doe </person> What happens to the text \*(L"23\*(R" will depend on the setting of \*(C`UndefinedXMLAttributes\*(C':
\s-1XML\s0 attributes are not parsed and not indexed. This is the default.
If the concatenated meta name (e.g. person.age) is not listed in MetaNames then indexing will be halted and an error reported.
The contents of the meta tag are ignored and not indexed unless a metaname has been defined with the \*(C`MetaNames\*(C' directive.
The contents of the meta tag are indexed, but placed in the main index unless there's an enclosing metatag already in force.
This method will create meta tags from the combined element and attributes (and \s-1XML\s0 Class name) This options should be used with caution as it can generate a lot of metaname entries. See also the example below \*(C`XMLClassAttribues\*(C'.
Combines an \s-1XML\s0 class name with the element name to make up a metaname. For example: XMLClassAttributes class <person class="first"> John </person> <person class="last"> Doe </person> Will appear to Swish-e as: <person> <person.first> John </person.first> </person> <person> <person.last> Doe </person.last> </person> How the data is indexed depends on \*(C`MetaNames\*(C' and \*(C`UndefinedMetaTags\*(C'. Here's an example using the following configuration which combines the two directives \*(C`XMLClassAttributes\*(C' and \*(C`UndefinedXMLAttributes\*(C'. XMLClassAttributes class UndefinedMetaTags auto UndefinedXMLAttributes auto IndexContents XML2 .xml The source \s-1XML\s0 file looks like: <xml> <person class="student" phone="555-1212" age="102"> John </person> <person greeting="howdy">Bill</person> </xml> Swish-e parses as: ./swish-e -c 2 -i 1.xml -T parsed_tags parsed_text -v 0 Indexing Data Source: "File-System" <xml> (MetaName) <person> (MetaName) <person.student> (MetaName) <person.student.phone> (MetaName) 555-1212 </person.student.phone> <person.student.age> (MetaName) 102 </person.student.age> John </person> <person> (MetaName) <person.greeting> (MetaName) howdy </person.greeting> Bill </person> </xml> Indexing done! One thing to note is that the first <person> block finds a class name \*(L"student\*(R" so all metanames that are created from attributes use the combined name \*(L"person.student\*(R". The second <person> block doesn't contain a \*(L"class\*(R" so, the attribute name is combined directly with the element name (e.g. \*(L"person.greeting\*(R").
This directive can be used to index extracted parts of a document's path. A common use would be to limit searches to specific areas of your file tree. The extracted string will be indexed under the specified meta name. See \*(C`ReplaceRules\*(C' for a description of the various pattern replacement methods, but you will use the regex method. For example, say your file system (or web tree) was organized into departments: /web/sales/foo... /web/parts/foo... /web/accounting/foo... And you wanted a way to limit searches to just documents under \*(L"sales\*(R". ExtractPath department regex !^/web/([^/]+)/.*$!$1! Which says, extract out the department name (as substring $1) and index it as meta name \*(C`department\*(C'. Then to limit a search to the sales department: swish-e -w foo AND department=sales Note that the \*(C`regex\*(C' method uses a substitution pattern, so to index only a sub-string match the entire document path in the regular expression, as shown above. Otherwise any part that is not matched will end up in the substitution pattern. See the \*(C`ExtractPathDefault\*(C' option for a way to set a value if not patterns match. Although unlikely, you may use more than one \*(C`ExtractPath\*(C' directive. More than one directive of the same meta name will operate successively (in order listed in the configuration file) on the path. This allows you to use regular expressions on the results of the previous pattern substitution (as if piping the output from one expression to the patter of the next). ExtractPath foo regex !^(...).+$!$1! ExtractPath foo regex !^.+(.)$!$1! So, the third letter is indexed as meta name \*(L"foo\*(R" if both patterns match. ExtractPath foo regex !^X(...).+$!$1! ExtractPath foo regex !^.+(.)$!$1! Now (not the \*(L"X\*(R"), if the first pattern doesn't match, the last character of the path name is indexed. You must be clear on this behavior if you are using more than one \*(C`ExtractPath\*(C' directive with the same metaname. The document path operated on is the real path swish used to access the document. That is, the \*(C`ReplaceRules\*(C' directive has no effect on the path used with \*(C`ExtractPath\*(C'. The full path is used for each meta name if more than one \*(C`ExtractPath\*(C' directive is used. That is, changes to the path used in \*(C`ExtractPath foo\*(C' do not affect the path used by \*(C`ExtractPath bar\*(C'.
This can be used with \*(C`ExtractPath\*(C' to set a default string to index under the given metaname if none of the \*(C`ExtractPath\*(C' patterns match. For example, say your want to index each document with a metaname \*(L"department\*(R" based on the following path examples: /web/sales/foo... /web/parts/foo... /web/accounting/foo... But you are also indexing documents that do not follow that pattern and you want to search those separately, too. ExtractPath department regex !^/web/([^/]+)/.*$!$1! ExtractPathDefault department other Now, you may search like this: -w foo department=(sales) - limit searches to the sales documents -w foo department=(parts) - limit searches to the parts documents -w foo department=(accounting) - limit searches to the accounting documents -w foo department=(other) - everything but sales, parts, and accounting. This basically is a shortcut for: -w foo not department=(sales or parts or accounting) but you don't need to keep track of what was extracted.
Swish-e allows you to specify certain \s-1META\s0 tags that can be used as document properties. The contents of any \s-1META\s0 tag that has been identified as a document property can be returned as part of the search results along with the rank, file name, title, and document size (see the \*(C`-p\*(C' and \*(C`-x\*(C' switches in SWISH-RUN). Properties are useful for returning additional data from documents in search results \*(-- this saves the effort of reading and parsing the source files while reading Swish-e search results, and is especially useful when the source documents are no longer available or slow to access (e.g. over http). Another feature of properties is that Swish-e can use the PropertyNames for sorting the search results (see the \*(C`-s\*(C' switch). PropertyNames author subjects Two variations are available. \*(C`PropertyNamesCompareCase\*(C' and \*(C`PropertyNamesIgnoreCase\*(C'. These tell Swish-e to either ignore or compare case when sorting results. The default for \*(C`PropertyNames\*(C' is to ignore the case. PropertyNamesIgnoreCase subject PropertyNamesCompareCase keyword The defaults for \*(L"internal\*(R" properties are: swishtitle -- ignore the case swishdocpath -- compare case swishdescription -- compare case These can be overridden with \*(C`PropertyNamesCompareCase\*(C' and \*(C`PropertyNamesIgnoreCase\*(C'. PropertyNamesCompareCase swishtitle Use of PropertyNames will increase the size of your index files, sometimes significantly. Properties will be compressed if Swish-e is compiled with zlib as described in the \s-1INSTALL\s0 manual page. If Swish-e finds more than one property of the same name in a document the property's contents will be concatinated for strings, and a warning issues for numeric (or date) properties.
PropertyNamesNoStripChars specifies that the listed properties should not have strings of low \s-1ASCII\s0 characters replaced with a space character. Properties will be stored as found in the document. When printing properties with the swish-e binary newlines are replaced with a space character. Use the swish-e library (or \s-1SWISH::API\s0 perl module) to fetch properties without newlines replaced.
This directive is similar to \*(C`PropertyNames\*(C', but it flags the property as being a string of digits (integer value) that will be stored as binary data instead of a string. This allows sorting with \*(C`-s\*(C' and limiting with \*(C`-L\*(C' to sort and limit the property correctly. Swish-e uses strtoul(3) to convert the string into an unsigned long integer. Therefore, only positive integers can be stored. Future versions of Swish-e may be able to store different property types (such as negative integers and real numbers). This directive may change in future releases of Swish.
This directive is exactly like \*(C`PropertyNamesNumeric\*(C', but it also flags the number as a machine timestamp (seconds since Epoch), and will print a formatted date when returning this property. See \*(C`-x\*(C' in SWISH-RUN. Swish-e will not parse dates when indexing; you must use a timestamp.
This allows aliases for a property name. For example, if you are indexing \s-1HTML\s0 files, plus \s-1XML\s0 files that are written in English, German, and Spanish and thus use the tags \*(L"title\*(R", \*(L"titel\*(R", and \*(L"título\*(R" you can use: PropertyNameAlias swishtitle title titel título titulo Note that \*(L"swishtitle\*(R" is the built-in property used to store the title of a document, and therefore you do not need to specify it as a PropertyName before use.
This option will set the max length of the text stored in a property. You must specify a number between 0 and the max integer size on your platform, and a list of properties. The properties specified must not be aliases. If any of the property names do not exist they will be created (e.g. you do not need to define the property with PropertyNames first). In general, this feature will only be useful when parsing \s-1HTML\s0 or \s-1XML\s0 with the libxml2 parser. For example: PropertyNamesMaxLength 1000 swishdescription PropertyNameAlias swishdescription body Is somewhat like StoreDescription HTML <body> 1000 StoreDescription XML <body> 1000 StoreDescription HTML2 <body> 1000 StoreDescription XML2 <body> 1000 but StoreDescription allows setting the tag for each parser type. PropertyNamesMaxLength 1000 headings PropertyNameAlias headings h1 h2 h3 h4 collects all the heading text into a single property called \*(L"headings\*(R", not to exceed 1000 characters.
Sets the length of the string used when sorting. The default is 100 characters. The -T metanames debugging option will list the current values for an index. This setting is used when sorting during indexing, and perhaps when sorting while searching. It also effects the order when limiting to a range of values with the -L option.
By default Swish-e generates presorted tables while indexing for each property name. This allows faster sorting when generating results. On large document collections this presorting may add to the indexing time, and also adds to the total size of the index. This directive can be used to customize exactly which properties will be presorted. If \*(C`PreSortedIndex\*(C' it is not present in the config file (default action), all the properties will be presorted at indexing time. If it is present without any parameter, no properties will be presorted. Otherwise, only the property names specified will be presorted. For example, if you only wish to sort results by a property called \*(C`title\*(C': PropertyNames title age time PreSortedIndex title
StoreDescription allows you to store a document description in the index file. This description can be returned in your search results when the \*(C`-x\*(C' switch is used to include the swishdescription for extended results, or by using \*(C`-p swishdescription\*(C'. The document type (\s-1XML\s0, \s-1HTML\s0 and \s-1TXT\s0) must match the document type currently being indexed as set by \*(C`IndexContents\*(C' or \*(C`DefaultContents\*(C'. See those directives for possible values. A common problem is using \*(C`StoreDescription\*(C' yet not setting the document's type with \*(C`IndexContents\*(C' or \*(C`DefaultContents\*(C'. Another problem is different types: IndexContents HTML2 .html StoreDescription HTML <body> Then .html documents are assigned a type of \s-1HTML2\s0 (and parsed by the libxml2 parser), but the description will not be stored since it is type \s-1HTML\s0 instead of \s-1HTML2\s0. For text documents you specify the type \s-1TXT\s0 (or \s-1TXT2\s0 or TXT*) and the number of characters to capture. StoreDescription TXT 20 The above stores only the first twenty characters from the text file in the Swish-e index file. For \s-1HTML\s0, and \s-1XML\s0 file types, specify the tag to use for the description, and optionally the number of characters to capture. If not specified will capture the entire contents of the tag. StoreDescription HTML <body> 20000 StoreDescription XML <desc> 40 Again, note that documents must be assigned a document type with \*(C`IndexContents\*(C' or \*(C`DefaultContents\*(C' to use this feature. Swish-e will compress the descriptions (or any other large property) if compiled to use zlib (see \s-1INSTALL\s0). This is recommended when using StoreDescription and a large number of documents. Compression of 30% to 50% is not uncommon with \s-1HTML\s0 files.
This directive sets the compression level used when storing properties to disk. A setting of zero is no compression, and a setting of nine is the most compression. The default depends on the default setting compiled with zlib, but is typically six. This option is useful when using \*(C`StoreDescription\*(C' to store a large amount text in properties (or if using \*(C`PropertyNames\*(C' with large property sizes). Properties must be over a value defined in config.h (100 is the default) before compression will be attempted. Swish-e will never store the results of the compression if the compressed data is larger than the original data. This option is only available when Swish-e is compiled with zlib support.
TruncateDocSize limits the size of a document while indexing documents and/or using filters. This config directive truncates the numbers of read bytes of a document to the specified size. This means: if a document is larger, read only the specified numbers of bytes of the document. Example: TruncateDocSize 10000000 The default is zero, which means read all data. Warning: If you use TruncateDocSize, use it with care! TruncateDocSize is a safety belt only, to limit e.g. filteroutput, when accessing databases, or to limit \*(L"runnaway\*(R" filters. Truncating doc input may destroy document structures for Swish-e (e.g. swish may miss closing tags for \s-1XML\s0 or \s-1HTML\s0 documents). TruncateDocSize does not currently work with the \*(C`prog\*(C' input source method.
Selects the type of index to create. Only one type of index may be created. It's a good idea to create both a normal index and a fuzzy index and allow your search interface select which index to use. Many people find the fuzzy searches to be too fuzzy. The available fuzzy indexing options can be displayed by running swish-e -T LIST_FUZZY_MODES Available options include:
Words are stored in the index without any conversion. This is the default.
This options uses one of the installed Snowball stemmers (http://snowball.tartarus.org/). The installed stemmers can be viewed by running swish-e -T LIST_FUZZY_MODES For example, to use the Spanish stemming module: FuzzyIndexingMode Stemming_es
**This option is no longer supported.** Selects the legacy Swish-e English stemmer. This is deprecated in favor of the Snowball English stemmer Stemming_en1. Words are converted using the Porter stemming algorithm. From: http://www.tartarus.org/~martin/PorterStemmer/ The Porter stemming algorithm (or Porter stemmer) is a process for removing the commoner morphological and inflexional endings from words in English. Its main use is as part of a term normalisation process that is usually done when setting up Information Retrieval systems. This will help a search for \*(L"running\*(R" to also find \*(L"run\*(R" and \*(L"runs\*(R", for example. The stemming function does not convert words to their root, rather programmatically removes endings on words in an attempt to make similar words with different endings stem to the same string of characters. It's not a perfect system, and searches on stemmed indexes often return curious results. For example, two entirely different words may stem to the same word. Stemming also can be confusing when used with a wildcard (truncation). For example, you might expect to find the word \*(L"running\*(R" by searching for \*(L"runn*\*(R". But this fails when using a stemmed index, as \*(L"running\*(R" stems to \*(L"run\*(R", yet searching for \*(L"runn*\*(R" looks for words that start with \*(L"runn\*(R".
Soundex was developed in the 1880s so records for people with similar sounding names could be found more readily. Soundex is a coded surname based on the way a surname sounds rather than spelling. Surnames that sound similar, like Smith and Smyth, are filed together under the same Soundex code. This is mostly useful for \s-1US\s0 English. Soundex should not be used to search for sound-alike words. Metaphone would be more appropriate for generic sound matching of words. Soundex should only be used where you need to search multiple documents for proper names which sound similar. This is primarily used for indexing genealogical records. This may be useful for indexing other collections of data consisting mostly of names. Many common name variations are matched by Soundex. The only notable exception is the first letter of the name. The first letter is not matched for sound.
Words are transformed into a short series of letters representing the sound of the word (in English). Metaphone algorithms are often used for looking up mis-spelled words in dictionary programs. From: http://aspell.sourceforge.net/metaphone/ Lawrence Philips' Metaphone Algorithm is an algorithm which returns the rough approximation of how an English word sounds. The \*(C`DoubleMetaphone\*(C' mode will sometimes generate two different metaphones for the same word. This is supposed to be useful when a word may be pronounced more than one way. A metaphone index should give results somewhere in between Soundex and Stemming.
Put yes to apply word stemming algorithm during indexing, else no. UseStemming no UseStemming yes When UseStemming is set to \*(C`yes\*(C' every word is stemmed before placing it in to the index. This option is deprecated. It has been superceded by \*(C`FuzzyIndexingMode\*(C'.
When UseSoundex is set to \*(C`yes\*(C' every word is converted to a Soundex code before placing it in to the index. This option is deprecated. It has been superceded by \*(C`FuzzyIndexingMode\*(C'.
Put yes to ignore the total number of words in the file when calculating ranking. Often better with merges and small files. Default is yes. IgnoreTotalWordCountWhenRanking no The default was changed from no to yes in version 2.2. \s-1NOTE:\s0 must be set to no if you intend to use the -R 1 option when searching.
Set the minimum length of an word. Shorter words will not be indexed. The default is 1 (as defined in src/config.h). MinWordLimit 5
Set the maximum length of an indexable word. Every longer word will not be indexed. The Default is 40 (as defined in src/config.h).
These settings define what a word consists of to the Swish-e indexing engine. Compiled in defaults are in src/config.h. When indexing Swish-e uses WordCharacters to split up the document into words. Words are defined by any string of non-blank characters that contain only the characters listed in WordCharacters. If a string of characters includes a character that is not in WordCharacters then the word will be spit into two or more separate words. For example: WordCharacters abde Would turn \*(L"abcde\*(R" into two words \*(L"ab\*(R" and \*(L"de\*(R". Next, of these words, any characters defined in IgnoreFirstChar are stripped off the start of the word, and IgnoreLastChar characters are stripped off the end of the word. This allows, for example, periods within a word (www.slashdot.com), but not at the end of a word. Characters in IgnoreFirstChar and IgnoreLastChar must be in WordCharacters. Finally, the resulting words \s-1MUST\s0 begin with one of the characters listed in BeginCharacters and end with one of the characters listed in EndCharacters. BeginCharacters and EndCharacters must be a subset of the characters in WordCharacters. Often, WordCharacters, BeginCharacters and EndCharacters will all be the same. Note that the same process applies to the query while searching. Getting these settings correct will take careful consideration and practice. It's helpful to create an index of a single test file, and then look at the words that are placed in the index (see the \*(C`-v 4\*(C', \*(C`-D\*(C' and \*(C`-k\*(C' searching switches). Currently there is only support for eight-bit characters. Example: WordCharacters .abcdefghijklmnopqrstuvwxyz BeginCharacters abcdefghijklmnopqrstuvwxyz EndCharacters abcdefghijklmnopqrstuvwxyz IgnoreFirstChar . IgnoreLastChar . So the string Please visit http://www.example.com/path/to/file.html. will be indexed as the following words: please visit http www.example.com path to file.html Which means that you can search for \*(C`www.example.com\*(C' as a single word, but searching for just \*(C`example\*(C' will not find the document. Note: when indexing \s-1HTML\s0 documents \s-1HTML\s0 entities are converted to their character equivalents before being processed with these directives. This is a change from previous versions of Swish-e where you were required to include the characters \*(C`0123456789\*(C' to index entities. See also \*(C`ConvertHTMLEntities\*(C'
The Buzzwords option allows you to specify words that will be indexed regardless of WordCharacters, BeginCharacters, EndCharacters, stemming, soundex and many of the other checks done on words while indexing. Buzzwords are case insensitive. Buzzwords should be separated by spaces and may span multiple directives. If the special format \*(C`File:filename\*(C' is used then the Buzzwords will be read from an external file during indexing. Examples: Buzzwords C++ TCP/IP Buzzwords File: ./buzzwords.lst If a Buzzword contains search operator characters they must be backslashed when searching. For example: Buzzwords C++ TCP/IP web=http ./swish-e -w 'web\=http' Buzzwords are found by splitting the text on whitespace, removing \*(C`IgnoreFirstChar\*(C' and \*(C`IgnoreLastChar\*(C' characters from the word, and then comparing with the list of \*(C`Buzzwords\*(C'. Therefore, if adding \*(C`Buzzwords\*(C' to an index you will probably want to define \*(C`IgnoreFirstChar\*(C' and \*(C`IgnoreLastChar\*(C' settings. Note: Buzzwords specific settings for \*(C`IgnoreFirstChar\*(C' and \*(C`IgnoreLastChar\*(C' may be used in the future.
This option enables zlib compression for individual word data in the index file. The default is \s-1NO\s0, that is the index word data is not compressed by default. Enabling this option can reduced the size of the index file, but at the expense of slower wildcard search times. The default changed from \s-1YES\s0 to \s-1NO\s0 starting with version 2.4.3.
The IgnoreWords option allows you to specify words to ignore, called stopwords. The default is to not use any stopwords. Words should be separated by spaces and may span multiple directives. If the special format \*(C`File:filename\*(C' is used then the stop words will be read from an external file during indexing. In previous versions of Swish-e you could use the directive IgnoreWords swishdefault - obsolete! to include a default list of compiled in stopwords. This keyword is no longer supported. Examples: IgnoreWords www http a an the of and or IgnoreWords File: ./stopwords.de
UseWords defines the words that Swish-e will index. Only the words listed will be indexed. You can specify a list of words following the directive (you may specify more than one \*(C`UseWords\*(C' directive in a config file), and/or use the \*(C`File:\*(C' form to specify a path to a file containing the words: UseWords perl python pascal fortran basic cobal php UseWords File: /path/to/my/wordlist Please drop the Swish-e list a note if you actually use this feature. It may be removed from future versions.
This automatically omits words that appear too often in the files (these words are called stopwords). Specify a whole percentage and a number, such as \*(L"80 256\*(R". This omits words that occur in over 80% of the files and appear in over 256 files. Comment out to turn off auto-stopwording. IgnoreLimit 50 1000 Swish-e must do extra processing to adjust the entire index when this feature is used. It is recommended that instead of using this feature that you decided what words are stopwords and add them to IngoreWords in your configuration file. To do this, use IgnoreLimit one time and note the stop words that are found while indexing. Add this list to IgnoreWords, and then remove IgnoreLimit from the configuration file.
\*(C`IgnoreMetaTags\*(C' defines a list of metatags to ignore while indexing \s-1XML\s0 files (and \s-1HTML\s0 files if using libxml2 for parsing \s-1HTML\s0). All text within the tags will be ignored \*(-- both for indexing (\*(C`MetaNames\*(C') and properties (\*(C`PropertyNames\*(C'). To still parse properties, yet do not index the text, see \*(C`UndefinedMetaTags\*(C'. This option is useful to avoid indexing specific data from a file. For example: <person> <first_name> William </first_name> <last_name> Shakespeare </last_name> <updated_date> April 25, 1999 </updated_date> </person> In the above example you might not want to index the updated date, and therefore prevent finding this record by searching -w 'person=(April)' This is solved by: IgnoreMetaTags updated_date See also \*(C`UndefinedMetaTags\*(C'.
Experimental Feature This experimental feature can be used to define a set of characters that describe a number. If a word is found to contain only those characters it will not be indexed. The characters listed must be part of \*(C`WordCharacters\*(C' settings. In other words, the \*(L"word\*(R" checked is a word that Swish-e would otherwise index. For example, IgnoreNumberChars 0123456789$., Then Swish-e would not index the following: 123 123,456.78 $123.45 You might be tempted to avoid indexing hex numbers with: IgnoreNumberChars 0123456789abcdef which will not index 0D31, but will also not index the word \*(L"bad\*(R". This is an experimental feature that may change in future versions. One possible change is to use regular expressions instead.
This option allows the user decide if to index the contents of \s-1HTML\s0 comments. Default is no. Set to yes if comment indexing is required. IndexComments yes Note: This is a change in the default behavior prior to version 2.2.
The TranslateCharacters directive maps the characters in string1 to the characters listed in string2. For example: # This will index a_b as a-b and ámo as amo TranslateCharacters _á -a \*(C`TranslateCharacters :ascii7:\*(C' is a predefined set of characters that will translate eight bit characters to ascii7 characters. Using the :ascii7: rule will translate \*(L"Ääç\*(R" to \*(L"aac\*(R". This means: searching \*(L"Çelik\*(R", \*(L"çelik\*(R" or \*(L"celik\*(R" will all match the same word. TranslateCharacters is done early in the indexing process, after converting \s-1HTML\s0 entities but before splitting the input text into words based on WordCharacters. So characters you are translating from do not need to be listed in word characters. The same character translations take place when searching.
When indexing Swish-e assigns a word position to each word. This enables phrase searching. There may be cases where you would like to prevent phrase matching. The BumpPositionCounterCharacters directive allows you to specify a set of characters that when found in the text will increment the word position \*(-- effectively preventing phrase matches across that character. For example, if you have a tag: <subjects> computer programming | apple computers </subjects> You might want to prevent matching \*(L"programming apple\*(R" in that meta name. BumpPositionCounterCharacters | There is no default, and you may list a string of characters.
Since metatags are typically separate data fields, the word position counter is automatically bumped between metatags (actually, bumped when a start tag is found and when an end tag is found). This prevents matching a phrase that spans more than one metaname. \*(C`DontBumpPositionOnEndTags\*(C' and \*(C`DontBumpPositionOnStartTags\*(C' disables this feature for the listed metanames. For example, <person> <first_name> William </first_name> <last_name> Shakespeare </last_name> <updated_date> April 25, 1999 </updated_date> </person> In the configuration file: DontBumpPositionOnEndTags first_name DontBumpPositionOnStartTags last_name This configuration allows this phrase search -w 'person=("william shakespeare")' but this phrase search will fail -w 'person=("shakespeare april")' Some directives have different uses depending on the source of the documents. These directives are only valid when using the File system method of indexing.
This directive specifies the allowable file suffixes (extensions) while indexing. The default is to index all files specified in IndexDir. # Only index .html .htm and .q files IndexOnly .html .htm .q \*(C`IndexOnly\*(C' checks that the file end in the characters listed. It does not check \*(L"extensions\*(R". \*(C`IndexOnly\*(C' is tested right before \*(C`FileRules\*(C' is processed.
Put \*(L"yes\*(R" to follow symbolic links in indexing, else \*(L"no\*(R". Default is no. FollowSymLinks no FollowSymLinks yes Note that when set to \*(C`no\*(C' extra stat\|(2) system calls must be made for each file. For large number of files you may see a small reduction in indexing time by setting this to \*(C`yes\*(C'. See also the \*(C`-l\*(C' switch in SWISH-RUN.
FileRules and FileMatch are used to, respectively, exclude and include files and directories to index. Since, by default, Swish-e indexes all files and recurses all directories (but see also \*(C`FollowSymLinks\*(C') you will typically only use \*(C`FileRules\*(C' to exclude files or directories. \*(C`FileMatch\*(C' is useful in a few cases, for example, to override the behavior of \*(C`IndexOnly\*(C'. Some examples are included below. Except for \*(C`FileRules title ...\*(C', this feature is only available for file access method (-S fs), which is the default indexing mode. Also, any pathname modification with \*(C`ReplaceRules\*(C' happens after the check for \*(C`FileRules\*(C'. (It's unlikely that you would exclude files with \*(C`FileRules\*(C' based on text you added with \*(C`ReplaceRules\*(C'!) The regular expression is a C regex.h extended regular expression. You may supply more than one regular expression per line, or use separate directives. Preceding the regular expression with the word \*(L"not\*(R" negates the match. The regular expression is compared against [type] as described below. For historical reasons, you can specify \*(C`contains\*(C' or \*(C`is\*(C'. \*(C`is\*(C' simply forces the regular expression to match at the start and end of the string (by internally prepending \*(L"^\*(R" and appending \*(L"$\*(R" to the regular expression). The \*(C`regex\*(C' option requires delimiter characters: FileRules title regex /^private/i The only advantage of \*(C`regex\*(C' is if you want to do case insensitive matches, or simply like your regular expressions to look like perl regular expressions. You must use matching delimiters; (), {}, and [], are not currently supported for no good reason other than laziness. Use quotes (" or ') around a pattern if it contains any white space. Note that the backslash character becomes the escape character within quotes. For example, these sets generate the same regular expressions. FileRules title is hello FileRules title contains ^hello$ FileRules title regex /^hello$/ These all need quotes due to the included space character FileRules title is "hello there" FileRules title contains "^hello there$" FileRules title regex "!^hello there$!" These show how the backslash must be doubled inside of quotes. Swish-e converts a double-backslash into a single backslash, and then passes that single onto the regular expression compiler. FileRules filename regex /\.pdf/ FileRules filename regex "/\\.pdf/" FileRules filename regex !hello\\there! # need double for real backslash FileRules filename regex "!hello\\\\there!" # need double-double inside of quotes Matching Types The following types of match strings my be supplied: FileRules pathname FileRules dirname FileRules filename FileRules directory FileRules title FileMatch pathname FileMatch filename FileMatch dirname FileMatch directory pathname matches the regular expression against the current pathname. The pathname may or may not be absolute depending on what you supplied to \*(C`IndexDir\*(C'. Example: # Don't index paths that contain private or hidden FileRules pathname contains (private|hidden) # Same thing FileRules pathname regex /(private|hidden)/ # Don't index exe files FileRules pathname contains \.exe$ dirname and filename split the path name by the last delimiter character into a directory name, and a file name. Then these are compared against the patterns supplied. Directory names do not have a trailing slash. All path names use the forward slash as a delimiter within Swish-e. Example: # Same as last example - don't index *.exe files. FileRules filename contains \.exe$ # Don't index any file called test.html files FileRules filename contains ^test\.html$ # Same thing FileRules filename is test\.html # Don't index any directories that contain "old" (/usr/local/myold/docs) FileRules dirname contains old # Don't index any directories that contain the path segment "old" (/usr/local/old/foo) FileRules dirname contains /old/ # Index only .htm, .html, plus any all-digit file names IndexOnly .htm .html FileMatch filename contains ^\d+$ # Same as previous, but maybe a little slower FileRules filename regex not !\.(htm|html)$! FileMatch filename contains ^\d+$ Swish-e checks these settings in the order of \*(C`pathname\*(C', \*(C`dirname\*(C', and \*(C`filename\*(C', and \*(C`FileMatch\*(C' patterns are checked before \*(C`FileRules\*(C', in general. This allows you to exclude most files with \*(C`FileRules\*(C', yet allow in a few special cases with \*(C`FileMatch\*(C'. For example: # Exclude all files of .exe, .bin, and .bat FileRules filename contains \.(exe|bin|bat)$ # But, let these two in FileMatch filename is baseball\.bat incoming_mail\.bin # Same, but as a single pattern FileMatch filename is (baseball\.bat|incoming_mail\.bin) The \*(C`directory\*(C' type is somewhat unique. When Swish-e recurses into a directory it will compare all the files in the directory with the pattern and then decide if that entire directory should or should not be indexed (or recursed). Note that you are matching against file names in a directory \*(-- and some of those names may be directory names. A \*(C`FileRules directory\*(C' match will cause Swish-e to ignore all files and sub-directories in the current directory. Warning: A match with \*(C`FileMatch directory\*(C' says to index everything in the *current* directory and ignore any FileRules for this directory. Example: # Don't index any directories (and sub directories) that contain # a file (or sub-directory) called "index.skip" FileRules directory contains ^index\.skip$ # Don't index directories that contain a .htaccess file. FileRules directory contains ^\.htaccess Note: While processing directories, Swish-e will ignore any files or directories that begin with a dot (\*(L".\*(R"). You may index files or directories that begin with a dot by specifying their name with \*(C`IndexDir\*(C' or \*(C`-i\*(C'. \*(C`title\*(C' checks for a pattern match in an \s-1HTML\s0 title. Example: FileRules title contains construction example pointers # This example says to ignore case FileRules title regex "/^Internal document/i" Note: \*(C`FileRules title\*(C' works for any input method (fs, prog, or http) that is parsed as \s-1HTML\s0, and where a title was found in the document. In case all this seems a bit confusing, processing a directory happens in the following order. First the directory name is checked: FileRules dirname - reject entire directory if matches Next the directory is scanned and each file name (which might be the name of a sub-directory) is checked: FileRules directory - reject entire dir if *any* files match FileMatch directory - accept entire dir if *any* files match Then, unless \*(C`FileMatch directory\*(C' matched, each file is tested with FileMatch. A match says to index the file without further testing (i.e. overrides FileRules and IndexOnly): FileMatch pathname \ FileMatch dirname - file is accepted if any match FileMatch filename / otherwise IndexOnly - file is checked for the correct file extension FileRules pathname \ FileRules dirname - file is rejected if any match FileRules filename / finally, the file is indexed. Files (not directories) listed with \*(C`IndexDir\*(C' or \*(C`-i\*(C' are processed in a similar way: FileMatch pathname \ FileMatch dirname - file is accepted if any match FileMatch filename / otherwise, the file is rejected if it doesn't have the correct extension or a FileRules matches. IndexOnly - file is checked for the correct file extension FileRules pathname \ FileRules dirname - file is rejected if any match FileRules filename / Note: If things are not indexing as you expect, create a directory with some test files and use the \*(C`-T regex\*(C' trace option to see how file names are checked. Start with very simple tests! The \s-1HTTP\s0 Access method is enabled by the \*(L"-S http\*(R" switch when indexing. It works by running a Perl program called SwishSpider which fetches documents from a web server.
Only text files (content-type of \*(L"text/*\*(R") are indexed with the \s-1HTTP\s0 Access Method. Other document types (e.g. \s-1PDF\s0 or MSWord) may be indexed as well. The SwishSpider will attempt to make use of the SWISH::Filter module (included with the Swish-e distribution) to convert documents into a format that Swish-e can index.
Note: The -S prog method of spidering (using spider.pl) can be a replacement for the -S http method. It offers more configuration options and better spidering speed.
These directives below are available when using the \s-1HTTP\s0 Access Method of indexing.
MaxDepth defines how many links the spider should follow before stopping. A value of 0 configures the spider to traverse all links. The default is MaxDepth 0. MaxDepth 5 Note: The default was changed from 5 to 0 in release 2.4.0
The number of seconds to wait between issuing requests to a server. This setting allows for more friendly spidering of remote sites. The default is 5 seconds. Delay 1 Note: The default was changed from 60 to 5 seconds in release 2.4.0
The location of a writable temp directory on your system. The \s-1HTTP\s0 access method tells the Perl helper to place its files in this location, and the \*(C`-e\*(C' switch causes Swish-e to use this directory while indexing. There is no default. TmpDir /tmp/swish If this directory does not exist or is not writable Swish-e will fail with an error during indexing. Note, the environment variables of \*(C`TMPDIR\*(C', \*(C`TMP\*(C', and \*(C`TEMP\*(C' (in that order) will override this setting.
The location of the Perl helper script called swishspider. If you use a relative directory, it is relative to your directory when you run Swish-e, not to the directory that Swish-e is in. The default is the location swishspider was installed. Normally this does not need to be set. SpiderDirectory /usr/local/swish
Often times the same site may be referred to by different names. A common example is that often http://www.some-server.com and http://some-server.com are the same. Each line should have a list of all the method/names that should be considered equivalent. Multiple EquivalentServer directives may be used. Each directive defines its own set of equivalent servers. EquivalentServer http://library.berkeley.edu http://www.lib.berkeley.edu EquivalentServer http://sunsite.berkeley.edu:2000 http://sunsite.berkeley.edu This section details the directives that are only available for the \*(L"prog\*(R" document source feature of Swish-e. The \*(L"prog\*(R" access method runs an external program that \*(L"feeds\*(R" documents to Swish-e. This allows indexing and filtering of documents from any source.
See prog - general purpose access method in the SWISH-RUN man page for more information.
A number of example programs for use with the \*(L"prog\*(R" access method are provided in the prog-bin directory. Please see those example if you have questions about implementing a \*(L"prog\*(R" input program.
This is a list of parameters that will be sent to the external program when running with the \*(L"prog\*(R" document source method. SwishProgParameters /path/to/config hello there IndexDir /path/to/program.pl Then running: swish-e -c config -S prog Swish-e will execute \*(C`/path/to/program.pl\*(C' and pass \*(C`/path/to/config hello there\*(C' as three command line arguments to the program. This directive makes it easy to pass settings from the Swish-e configuration file to the external program. For example, the \*(C`spider.pl\*(C' program (included in the \*(C`prog-bin\*(C' directory) uses the \*(C`SwishProgParameters\*(C' to specify what file to read for configuration information. SwishProgParameters spider.config IndexDir ./spider.pl The \*(C`spider.pl\*(C' program also has a default action so you can avoid using a configuration file: SwishProgParameters default http://www.swishe.org/ http://some.other.site/ IndexDir ./spider.pl And the spider program will use default settings for spidering those sites. Swish-e can read documents from standard input, so another way to run an external program with parameters is: ./spider.pl spider.conf | ./swish-e -S prog -i stdin
Notes when using \s-1MS\s0 Windows
You should use unix style path separators to specify your external program. Swish will convert forward slashes to backslashes before calling the external program. This is only true for the program name specified with \*(C`IndexDir\*(C' or the \*(C`-i\*(C' command line option.
In addition, Swish-e will make sure the program specified actually exists, which means you need to use the full name of the program.
For example, to run the perl spider program spider.pl you would need a Swish-e configuration file such as:
IndexDir e:/perl/bin/perl.exe SwishProgParameters prog-bin/spider.pl default http://swish-e.org
and run indexing with the command:
swish-e -c swish.cfg -S prog -v 9
The \*(C`IndexDir\*(C' command tells Swish-e the name of the program to run. Under unix you can just specify the name of the script, since unix will figure out the program from the first line of the script.
The \*(C`SwishProgParameters\*(C' are the parameters passed to the program specified by \*(C`IndexDir\*(C' (perl.exe in this case). The first parameter is the perl script to run (prog-bin/spider.pl). Perl passes the rest of the parameters directly to the perl script. The second parameter default tells the spider.pl program to use default settings for spidering (or you could specify a spider config file \*(-- see \*(C`perldoc spider.pl\*(C' for details), and lastly, the \s-1URL\s0 is passed into the spider program. Internally, Swish-e knows how to parse only text, \s-1HTML\s0, and \s-1XML\s0 documents. With \*(L"filters\*(R" you can index other types of documents. For example, if all your web pages are in gzip format a filter can uncompress these on the fly for indexing.
You may wish to read the Swish-e \s-1FAQ\s0 question on filtering before continuing here. How Do I filter documents?
There are two suggested methods for filtering.
Filtering with SWISH::Filter
The Swish-e distribution includes a Perl module called SWISH::Filter and individual filters located in the filters directory. This system uses plug-in filters to extend the types of documents that Swish-e can index. The plug-in filters do not actually do the filtering, but rather provide a standard interface for accessing programs that can filter or convert documents. The programs that do the filtering are not part of the Swish-e distribution; they must be downloaded and installed separately.
The advantage of this method is that new filtering methods can be installed easily.
This system is designed to work with the -S http and -prog methods, but may also be used with the \*(C`FileFilter\*(C' feature and -S fs indexing method. See $prefix/share/doc/swish-e/examples/filter-bin/swish_filter.pl for an example.
See the filters/README file for more information.
Filtering with the FileFilter feature
A filter is an external program that Swish-e executes while processing a document of a given type. Swish-e will execute the filter program for each file that matches the file suffix (extension) set in the FileFilter or FileFilterMatch directives. FileFilterMatch matches using regular expressions and is described below.
Filters may be used with any type of input method (i.e. -S fs, -S http, or -S prog). But because
Swish-e calls the external program passing as default arguments:
the name of the filter program
the physical path name of the file to read. This may be a temporary file location if indexing by the http method.
When indexing under the file system this will be the same as $1 (the path to the source file), but when indexing under the http method this will be the \s-1URL\s0 of the source document.
Swish-e can also pass other parameters to the filter program. These parameters can be defined using the FileFilter or FileFilterMatch directives. See Filter Options below.
The filter program must open the file, process its contents, and return it to Swish-e by printing to \s-1STDOUT\s0.
Note that this can add a significant amount of time to the indexing process if your external program is a perl or shell script. If you have many files to filter you should consider writing your filter in C instead of a shell or perl script, or using the \*(L"prog\*(R" Access Method along with SWISH::Filter.
Deprecated. This is the path to a directory where the filter programs are stored. Swish-e looks in this directory to find the filter specified in the FileFilter directive. This directive is not needed if the filter program can be found in your system's path. Even if your filter is not in your system's path you can specify the full path to the filter in the FileFilter or FileFilterMatch directives. Example: FilterDir /usr/local/swish/filters This maps file suffix (extension) to a filter program. If filter-prog starts with a directory delimiter (absolute path), Swish-e doesn't use the FilterDir settings, but uses the given filter-prog path directly. On systems that have a working fork\|(2) system call the filter program is run by forking swish then executing the filter. This mean the shell is not used for running the filter and no arguments are passed through the shell. On other systems (e.g. Windows) the arguments are double-quoted and popen\|(3) is used to run the program. This does pass argument though the shell and may be a security concern depending on the abilities of the shell. Filter options: Filter options are a string passed as arguments to the filter-prog. Filter options can contain variables, replaced by Swish-e. If you omit filter-options Swish-e will use default parameters for the options listed above. Default: %p %P Which means: pass "workfile path" and "documentfile path" to filter. Variables in filter options: %% = % %P = Full document pathname (e.g. URL, or path on filesystem) %p = Full pathname to work file (maybe a tmpfile or the real document path on filesystem) %F = Filename stripped from full document pathname %f = Filename stripped from "work" pathname %D = Directoryname stripped from full document pathname %d = Directoryname stripped from full "work" pathname Examples of strings passed: %P = document pathname: http://myserver/path1/mydoc.txt %p = work pathname: /tmp/tmp.1234.mydoc.txt %F = mydoc.txt %f = tmp.1234.mydoc.txt %D = http://myserver/path1 %d = /tmp Notes when using \s-1MS\s0 Windows Windows uses double quotes to escape shell metacharacters, so if you need to use quotes then use single quotes around the entire option string. FileFiler .mydoc mydocfilter.exe '--title "text with spaces"' You can specify the filter program using forward slashes (unix style). Swish will convert the slashes to backslashes before running your program. FileFilter .mydoc c:/some/path/mydocfilter.exe '-d "%d" -example -url "%P" "%f"' Examples of filters: FileFilter .doc /usr/local/bin/catdoc "-s8859-1 -d8859-1 %p" FileFilter .pdf pdftotext "%p -" FileFilter .html.gz gzip "-c %p" FileFilter .mydoc "/some/path/mydocfilter" "-d %d -example -url %P %f" The above examples are running a binary filter program. For more complicated filtering needs you may use a scripting language such as Perl or a shell script. Here's some examples of calling a shell and perl script: FileFilter .pdf pdf2html.sh FileFilter .ps ghostscript-filter.pl Using a scripting language (or any language that has a large startup cost) can greatly increase the indexing time. For small indexing jobs, this may not be an issue, but for large collections of files that require processing by a scripting language, you may be better off using the \*(C`-S prog\*(C' access method where the script will only be compiled once, instead of for each document. Filters are probably easier to write than a \*(C`-S prog\*(C' program. Which you decide to use depends on your requirements. Examples of filter scripts can be found in the filter-bin directory, and examples of \*(C`-S prog\*(C' programs can be found in the prog-bin directory.
This is similar to \*(C`FileMatch\*(C' except uses regular expressions to match against the file name. *filter-prog* is the path to the program. Unlike \*(C`FileFilter\*(C' this does not use the \*(C`FilterDir\*(C' option. Also unlike \*(C`FileFilter\*(C' you must specify the *filter-options*. Examples: FileFilterMatch ./pdftotext "%p -" /\.pdf$/ Note that will also match a file called \*(L".pdf\*(R", so you may want to use something that requires a filename that has more than just an extension. For example: FileFilterMatch ./pdftotext "%p -" /.\.pdf$/ To specify more than one extension: FileFilterMatch ./check_title.pl "%p" /\.html$/ /\.htm$/ Or a few ways to do the same thing: FileFilterMatch ./check_title.pl %p /\.(html|html)$/ FileFilterMatch ./check_title.pl %p /\.html?$/ And to ignore case: FileFilterMatch ./check_title.pl %p /\.html?$/i You may also precede an expression with \*(L"not\*(R" to negate regular expression that follow. For example, to match files that do not have an extension: FileFilterMatch ./convert "%p %P" not /\..+$/
$Id: \s-1SWISH-CONFIG\s0.pod 1846 2006-10-20 20:18:30Z whmoseley $
.