Chapter 2. Indexing

2.1. Introduction

Indexing is the process by which the set of documents is analyzed and the data entered into the database. Recoll indexing is normally incremental: documents will only be processed if they have been modified since the last run. On the first execution, all documents will need processing. A full index build can be forced later by specifying an option to the indexing command (recollindex -z or -Z).

The following sections give an overview of different aspects of the indexing processes and configuration, with links to detailed sections.

2.1.1. Indexing modes

Recoll indexing can be performed along two different modes:

  • Periodic (or batch) indexing: indexing takes place at discrete times, by executing the recollindex command. The typical usage is to have a nightly indexing run programmed into your cron file.

  • Real time indexing: indexing takes place as soon as a file is created or changed. recollindex runs as a daemon and uses a file system alteration monitor such as inotify, Fam or Gamin to detect file changes.

The choice between the two methods is mostly a matter of preference, and they can be combined by setting up multiple indexes (ie: use periodic indexing on a big documentation directory, and real time indexing on a small home directory). Monitoring a big file system tree can consume significant system resources.

The choice of method and the parameters used can be configured from the recoll GUI: PreferencesIndexing schedule

2.1.2. Configurations, multiple indexes

The parameters describing what is to be indexed and local preferences are defined in text files contained in a configuration directory.

All parameters have defaults, defined in system-wide files.

Without further configuration, Recoll will index all appropriate files from your home directory, with a reasonable set of defaults.

A default personal configuration directory ($HOME/.recoll/) is created when a Recoll program is first executed. It is possible to create other configuration directories, and use them by setting the RECOLL_CONFDIR environment variable, or giving the -c option to any of the Recoll commands.

In some cases, it may be interesting to index different areas of the file system to separate databases. You can do this by using multiple configuration directories, each indexing a file system area to a specific database. Typically, this would be done to separate personal and shared indexes, or to take advantage of the organization of your data to improve search precision.

The generated indexes can be queried concurrently in a transparent manner.

For index generation, multiple configurations are totally independant from each other. When multiple indexes need to be used for a single search, some parameters should be consistent among the configurations.

2.1.3. Document types

Recoll knows about quite a few different document types. The parameters for document types recognition and processing are set in configuration files.

Most file types, like HTML or word processing files, only hold one document. Some file types, like email folders or zip archives, can hold many individually indexed documents, which may themselves be compound ones. Such hierarchies can go quite deep, and Recoll can process, for example, a LibreOffice document stored as an attachment to an email message inside an email folder archived in a zip file...

Recoll indexing processes plain text, HTML, OpenDocument (Open/LibreOffice), email formats, and a few others internally.

Other file types (ie: postscript, pdf, ms-word, rtf ...) need external applications for preprocessing. The list is in the installation section. After every indexing operation, Recoll updates a list of commands that would be needed for indexing existing files types. This list can be displayed by selecting the menu option FileShow Missing Helpers in the recoll GUI. It is stored in the missing text file inside the configuration directory.

By default, Recoll will try to index any file type that it has a way to read. This is sometimes not desirable, and there are ways to either exclude some types, or on the contrary to define a positive list of types to be indexed. In the latter case, any type not in the list will be ignored.

Excluding types can be done by adding wildcard name patterns to the skippedNames list, which can be done from the GUI Index configuration menu. For versions 1.20 and later, you can alternatively set the excludedmimetypes list in the configuration file. This can be redefined for subdirectories.

You can also define an exclusive list of MIME types to be indexed (no others will be indexed), by settting the indexedmimetypes configuration variable. Example:

indexedmimetypes = text/html application/pdf
          

It is possible to redefine this parameter for subdirectories. Example:

[/path/to/my/dir]
indexedmimetypes = application/pdf
          

(When using sections like this, don't forget that they remain in effect until the end of the file or another section indicator).

excludedmimetypes or indexedmimetypes, can be set either by editing the main configuration file (recoll.conf), or from the GUI index configuration tool.

2.1.4. Recovery

In the rare case where the index becomes corrupted (which can signal itself by weird search results or crashes), the index files need to be erased before restarting a clean indexing pass. Just delete the xapiandb directory (see next section), or, alternatively, start the next recollindex with the -z option, which will reset the database before indexing.