IndexIf -- allows indexing documents whose section matches the given pattern



IndexIf [Match | NoMatch] [NoCase | Case] [String | Regex] {Section} {Pattern...}


IndexIf allows indexing of documents, whose section matches the given pattern. Should typically be used in combination with NoIndexIf.

The first three optional parameters describe the type of comparison. The default values are Match, Case, String (case insensitive string pattern match with ? and * wildcards).

The Section parameter specifies which section is checked against the pattern. It can also be a concatenation of multiple sections, composed with help of ${SECTION} syntax.

It is possible to use multiple patterns in the same IndexIf command. In this case the command will be applied as soon as the first matching pattern is found.


IndexIf takes global effect for the entire configuration file and can be used multiple times.


# Example1: Don't index a document if its Body section contains "porno"
NoIndexIf Body *porno*
IndexIf Body *

# Example2: Index only those documents with Title section containing "reference"
IndexIf Title *reference*
NoIndexIf Title *

# Example3: Allow indexing of text/plain documents only from the given site.
IndexIf "${URL}#${Content-Type}" "http://site/*#text/plain"
NoIndexIf Content-Type text/plain

See also

Allow, Index, NoIndexIf, Robots, Skip, SkipIf.