Recoll user manual

Jean-Francois Dockes

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at the following location: GNU web site.

This document introduces full text search notions and describes the installation and use of the Recoll application. This version describes Recoll 1.42.


Table of Contents

1. Introduction
1.1. Giving it a try
1.2. Full text search
1.3. Recoll overview
2. Indexing
2.1. Introduction
2.1.1. Indexing modes
2.1.2. Configurations, multiple indexes
2.1.3. Document types
2.1.4. Indexing failures
2.1.5. Recovery
2.2. Index storage
2.2.1. Xapian index formats
2.2.2. Security aspects
2.2.3. Special considerations for big indexes
2.3. Index configuration
2.3.1. The index configuration GUI
2.3.2. Multiple indexes
Creating and using an additional index: Linux example
Creating an alternate index: Windows example
2.3.3. Index case and diacritics sensitivity
2.4. Indexing performance and resource usage
2.4.1. Indexing threads configuration (Unix-like systems)
2.4.2. Using multiple temporary indexes to improve indexing time (1.41.1)
2.4.3. Quieting down the indexing process
2.5. Index update scheduling
2.5.1. Periodic indexing
2.5.2. Real time indexing
2.6. Fields and metadata
2.6.1. Incorporating external metadata
Unix-like systems and MacOS systems: using extended attributes
Using a command for importing external metadata
2.7. Miscellaneous indexing notes
2.7.1. Indexing punctuation characters (1.39)
2.7.2. The PDF input handler
Extracting PDF outlines and bookmarks
XMP fields extraction
PDF attachment indexing
2.7.3. Running OCR on image documents
2.7.4. Running a speech to text program on audio files
2.7.5. Removable volumes
2.7.6. Unix-like systems: indexing visited Web pages
3. Searching
3.1. Introduction
3.2. Searching with the Qt graphical user interface (GUI)
3.2.1. Simple search
3.2.2. The result list
3.2.3. The result table
3.2.4. The filters panel
3.2.5. Running arbitrary commands on result files
3.2.6. Unix-like systems: displaying thumbnails
3.2.7. The preview window
3.2.8. The Query Fragments window
3.2.9. Assisted Complex Search (A.K.A. "Advanced Search")
Advanced search: the "find" tab
Advanced search: the "filter" tab
Advanced search history
3.2.10. The term explorer tool
3.2.11. Searching across multiple indexes
3.2.12. Document history
3.2.13. Sorting search results and collapsing duplicates
3.2.14. Keyboard shortcuts
3.2.15. Search tips
Terms and search expansion
Working with phrases and proximity
Others
3.2.16. Saving and restoring queries
3.2.17. Customising the search interface
Choosing the viewer applications
The GUI preferences dialog
The result list format
3.2.18. The recoll GUI command line options
3.3. Searching with the KDE KIO slave
3.4. Searching on the command line
3.5. The query language
3.5.1. General syntax
3.5.2. Special field-like specifiers
3.5.3. Range clauses
3.5.4. Modifiers
3.6. Wildcards and anchored searches
3.6.1. Wildcards
3.6.2. Anchored searches
3.7. Using Synonyms
3.8. Path translations
3.9. Search case and diacritics sensitivity
3.10. Desktop integration
4. Programming interface
4.1. Writing a document input handler
4.1.1. Simple input handlers
4.1.2. "Multiple" handlers
4.1.3. Telling Recoll about the handler
4.1.4. Input handler output
4.1.5. Page numbers
4.2. Field data processing
4.3. Python API
4.3.1. Introduction
4.3.2. Interface elements
4.3.3. Log messages for Python scripts
4.3.4. Python search interface
The recoll module
The rclextract module
Search API usage example
The fsudi module
4.3.5. Python indexing interface
Recoll external indexers
The Python indexing API
External indexers configuration
External indexer samples
Using an external indexer index in conjunction with a regular one
5. Configuration
5.1. Settings, configuration overview
5.2. Environment variables
5.3. The fields file
5.3.1. Extended attributes in the fields file
5.4. The mimemap file
5.5. The mimeconf file
5.6. The mimeview file
5.7. The ptrans file
5.8. Examples of configuration adjustments
5.8.1. Adding an external viewer for an non-indexed type
5.8.2. Adding indexing support for a new file type
I. Appendices
A. Processing of wild card and other special characters
A.1. Words and spans
A.2. Special ASCII characters during indexing
A.2.1. Characters with hard-coded processing
A.2.2. Characters generally treated as white space
A.2.3. Backslash
A.3. Special ASCII characters at search time
A.3.1. Query language special characters
A.3.2. Wild card characters
B. Building and Installation
B.1. Installing a binary copy
B.2. Supporting packages
B.3. Building from source
B.3.1. Prerequisites
B.3.2. Building
B.3.3. Installing
B.3.4. Python API package

List of Tables

3.1. Keyboard shortcuts

Chapter 1. Introduction

This document introduces full text search notions and describes the installation and use of the Recoll application. It is updated for Recoll 1.42.

Recoll was for a long time dedicated to Unix-like systems. It was only lately (2015) ported to MS-Windows. Many references in this manual, especially file locations, are specific to Unix, and not valid on Windows, where some described features are also not available. The manual will be progressively updated. Until this happens, on Windows, most references to shared files can be translated by looking under the Recoll installation directory (Typically C:/Program Files (x86)/Recoll). Especially, anything referenced inside /usr/share in this document will be found in the Share subdirectory of the installation). The user configuration is stored by default under AppData/Local/Recoll inside the user directory, along with the index itself.

1.1. Giving it a try

If you do not like reading manuals (who does?) but wish to give Recoll a try, just install the application and start the recoll graphical user interface (GUI), which will ask permission to index your home directory, allowing you to search immediately after indexing completes.

Do not do this if your home directory contains a huge number of documents and you do not want to wait or are very short on disk space. In this case, you may first want to customise the configuration to restrict the indexed area. From the recoll GUI go to: PreferencesIndexing configuration, then adjust the Start folders section (or Top directories in older Recoll versions), which defines the directories from which the filesystem exploration starts.

By default, the indexer process writes all errors to its stderr output, which may be lost if you started the GUI from the desktop. You may find it useful to assign a file name to the Indexer log file name entry on the above indexing preferences screen. With the default level of 3, this will list all processed documents, and all errors (lines beginning with :2:).

On Unix-like systems, you may need to install the appropriate supporting applications for document types that need them (for example antiword for Microsoft Word files). The Windows package is self-contained and includes most useful auxiliary programs. After the indexing ran, the recoll GUI ToolsMissing helpers menu entry will show a list of missing supporting applications for the documents found in the indexed area.

1.2. Full text search

Recoll is a full text search application, which means that it finds your data by content rather than by external attributes (like the file name). You specify words (terms) which should or should not appear in the text you are looking for, and receive in return a list of matching documents, ordered so that the most relevant documents will appear first.

You do not need to remember in what file or email message you stored a given piece of information. You just ask for related terms, and the tool will return a list of documents where these terms are prominent, in a similar way to Internet search engines.

Full text search applications try to determine which documents are most relevant to the search terms you provide. Computer algorithms for determining relevance can be very complex, and in general are inferior to the power of the human mind to rapidly determine relevance. The quality of relevance guessing is probably the most important aspect when evaluating a search application. Recoll relies on the Xapian probabilistic information retrieval library to determine relevance.

In many cases, you are looking for all the forms of a word, including plurals, different tenses for a verb, or terms derived from the same root or stem (example: floor, floors, floored, flooring...). Queries are usually automatically expanded to all such related terms (words that reduce to the same stem). This can be prevented for searching for a specific form.

Stemming, by itself, does not accommodate for misspellings or phonetic searches. A full text search application may also support this form of approximation. For example, a search for aliterattion returning no result might propose alliteration, alteration, alterations, or altercation as possible replacement terms. Recoll bases its suggestions on the actual index contents, so that suggestions may be made for words which would not appear in a standard dictionary.

1.3. Recoll overview

Recoll uses the Xapian information retrieval library as its storage and retrieval engine. Xapian is a very mature package using a sophisticated probabilistic ranking model.

The Xapian library manages an index database which describes where terms appear in your document files. It efficiently processes the complex queries which are produced by the Recoll query expansion mechanism, and is in charge of the all-important relevance computation task.

Recoll provides the mechanisms and interface to get data into and out of the index. This includes translating the many possible document formats into pure text, handling term variations (using Xapian stemmers), and spelling approximations (using the aspell speller), interpreting user queries and presenting results.

In a shorter way, Recoll does the dirty footwork, Xapian deals with the intelligent parts of the process.

The Xapian index can be big (roughly the size of the original document set), but it is not a document archive. Recoll can only fully display documents that still exist at the place from which they were indexed. However, recent Recoll version do store the plain text from all indexed documents.

Recoll stores all internal data in Unicode UTF-8 format, and it can index many types of files with different character sets, encodings, and languages into the same index. It can process documents embedded inside other documents (for example a PDF document stored inside a Zip archive sent as an email attachment...), down to an arbitrary depth.

By default. Recoll processes east asian texts by generating terms as arbitrary sequences of consecutive characters (n-grams). However, it has provisions to integrate with language-aware text segmenters for Chinese and Korean which will produce a smaller index and improved search.

Stemming is the process by which Recoll reduces words to their radicals so that searching does not depend, for example, on a word being singular or plural (floor, floors), or on a verb tense (flooring, floored). Because the mechanisms used for stemming depend on the specific grammatical rules for each language, there is a separate Xapian stemmer module for most common languages where stemming makes sense.

Recoll stores the unstemmed versions of terms in the main index and uses auxiliary databases for term expansion (one for each stemming language), which means that you can switch stemming languages between searches, or add a language without needing a full reindex.

Storing documents written in different languages in the same index is possible, and commonly done. In this situation, you can specify several stemming languages for the index.

Recoll currently makes no attempt at automatic language recognition, which means that the stemmer will sometimes be applied to terms from other languages with potentially strange results. In practise, even if this introduces possibilities of confusion, this approach has been proven quite useful, and it is much less cumbersome than separating your documents according to what language they are written in.

By default, Recoll strips most accents and diacritics from terms, and converts them to lower case before either storing them in the index or searching for them. As a consequence, it is impossible to search for a particular capitalization of a term (US / us), or to discriminate two terms based on diacritics (sake / saké, mate / maté).

Recoll can optionally store the raw terms, without accent stripping or case conversion. In this configuration, default searches will behave as before, but it is possible to perform searches sensitive to case and diacritics. This is described in more detail in the section about index case and diacritics sensitivity.

Recoll uses many parameters to define exactly what to index, and how to classify and decode the source documents. These are kept in configuration files. A default configuration is copied into a standard location (usually something like /usr/share/recoll/examples) during installation. The default values set by the configuration files in this directory may be overridden by values set inside your personal configuration. With the default configuration, Recoll will index your home directory with generic parameters. Most common parameters can be set by using configuration menus in the recoll GUI. Some less common parameters can only be set by editing the text files.

The indexing process is started automatically (after asking permission), the first time you execute the recoll GUI. Indexing can also be performed by executing the recollindex command. Recoll indexing is multithreaded by default when appropriate hardware resources are available, and can perform multiple tasks in parallel for text extraction, segmentation and index updates.

Searches are usually performed inside the recoll GUI, which has many options to help you find what you are looking for. However, there are other ways to query the index:

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).

recollindex skips files which caused an error during a previous pass. This is a performance optimization, and the command line option -k can be set to retry failed files, for example after updating an input handler.

When a file has been deleted, recollindex removes the corresponding data from the index. The exact moment when this happens depends on the indexing mode. There are provisions to avoid deleting data for an umounted removable volume.

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

Depending on your data, temporary files may be needed during indexing, some of them possibly quite big. You can use the RECOLL_TMPDIR or TMPDIR environment variables to determine where they are created (the default is to use /tmp). Using TMPDIR has the nice property that it may also be taken into account by auxiliary commands executed by recollindex.

2.1.1. Indexing modes

Recoll indexing can be performed along two main modes:

  • Periodic (or batch) indexingrecollindex is executed at discrete times. On Unix-like systems, the typical usage is to have a nightly run programmed into your cron file. On Windows, the Task Scheduler can be used to run indexing. In both cases, the Recoll GUI includes a simplified interface to configure the system scheduler.

  • Real time indexingrecollindex runs permanently as a daemon and uses a file system alteration monitor (e.g. inotify on Unix-like systems) to detect file changes. New or updated files are indexed at once. Monitoring a big file system tree can consume significant system resources.

Choosing an indexing mode

The choice between the two methods is mostly a matter of preference, and they can be combined by setting up multiple indexes (e.g.: use periodic indexing on a big documentation directory, and real time indexing on a small home directory), or by configuring the index so that only a subset of the tree will be monitored.

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

2.1.2. Configurations, multiple indexes

Recoll supports defining multiple indexes, each defined by its own configuration directory. A configuration directory contains several files which describe what should be indexed and how.

When recoll or recollindex is first executed, it creates a default configuration directory. This configuration is the one used for indexing and querying when no specific configuration is specified. It is located in $HOME/.recoll/ for Unix-like systems and %LOCALAPPDATA%/Recoll on Windows (typically C:/Users/[me]/Appdata/Local/Recoll).

All configuration parameters have defaults, defined in system-wide files. Without further customisation, the default configuration will process your complete home directory, with a reasonable set of defaults. It can be adjusted to process a different area of the file system, select files in different ways, and many other things.

In some cases, it may be useful to create additional configuration directories, for example, to separate personal and shared indexes, or to take advantage of the organization of your data to improve search precision.

In order to do this, you would create an empty directory in a location of your choice, and then instruct recoll or recollindex to use it by setting either a command line option (-c /some/directory), or an environment variable (RECOLL_CONFDIR=/some/directory). Any modification performed by the commands (e.g. configuration customisation or searches by recoll or index creation by recollindex) would then apply to the new directory and not to the default one.

Once multiple indexes are created, you can use each of them separately by setting the -c option or the RECOLL_CONFDIR environment variable when starting a command, to select the desired index.

It is also possible to instruct one configuration to query one or several other indexes in addition to its own, by using the External index function in the recoll GUI, or some equivalent in the command line and programming tools.

A plausible usage scenario for the multiple index feature would be for a system administrator to set up a central index for shared data, that you choose to search or not in addition to your personal data. Of course, there are other possibilities. for example, there are many cases where you know the subset of files that should be searched, and where narrowing the search can improve the results. You can achieve approximately the same effect by using a directory filter clause in a search, but multiple indexes may have better performance and may be worth the trouble in some cases.

A more advanced use case would be to use multiple indexes to improve indexing performance, by updating several indexes in parallel (using multiple CPU cores and disks, or possibly several machines), and then merging them, or querying them in parallel.

See the section about configuring multiple indexes for more detail

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...

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

Other file types (e.g.: 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.

After installing a missing handler, you may need to tell recollindex to retry the failed files, by adding option -k to the command line, or by using the GUI FileSpecial indexing menu. This is because recollindex, in its default operation mode, will not retry files which caused an error during an earlier pass. In special cases, it may be useful to reset the data for a category of files before indexing. See the recollindex manual page. If your index is not too big, it may be simpler to just reset it.

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 define a positive list of types to be indexed. In the latter case, any type not in the list will be ignored.

Excluding files by name can be done by adding wildcard name patterns to the skippedNames list, which can be done from the GUI Index configuration menu. Excluding by type can be done by setting 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 setting 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 configuration file (recoll.conf) for the index, or by using the GUI index configuration tool.

Note about MIME types

When editing the indexedmimetypes or excludedmimetypes lists, you should use the MIME values listed in the mimemap file or in Recoll result lists in preference to file -i output: there are a number of differences. The file -i output should only be used for files without extensions, or for which the extension is not listed in mimemap

2.1.4. Indexing failures

Indexing may fail for some documents, for a number of reasons: a helper program may be missing, the document may be corrupt, we may fail to uncompress a file because no file system space is available, etc.

The Recoll indexer in versions 1.21 and later does not retry failed files by default, because some indexing failures can be quite costly (for example failing to uncompress a big file because of insufficient disk space). Retrying will only occur if an explicit option (-k) is set on the recollindex command line, or if a script executed when recollindex starts up says so. The script is defined by a configuration variable (checkneedretryindexscript), and makes a rather lame attempt at deciding if a helper command may have been installed, by checking if any of the common bin directories have changed.

2.1.5. 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. The difference between the two methods is that the second will not change the current index format, which may be undesirable if a newer format is supported by the Xapian version.

2.2. Index storage

The default index location is the xapiandb subdirectory of the Recoll configuration directory, typically $HOME/.recoll/xapiandb/ on Unix-like systems or C:/Users/[me]/Appdata/Local/Recoll/xapiandb on Windows. This can be changed via two different methods (with different purposes):

  1. For a given configuration directory, you can specify a non-default storage location for the index by setting the dbdir parameter in the configuration file (see the configuration section). Use this method to keep the configuration directory in its default location, and use another location for the index, typically because of disk occupation or performance reasons.

  2. You can specify a different configuration directory by setting the RECOLL_CONFDIR environment variable, or using the -c option to the Recoll commands. This method would typically be used to index different areas of the file system to different indexes. For example, if you were to issue the following command:

    recoll -c ~/.indexes-email

    Then Recoll would use configuration files stored in ~/.indexes-email/ and, (unless specified otherwise in recoll.conf) would look for the index in ~/.indexes-email/xapiandb/.

    Using multiple configuration directories and configuration options allows you to tailor multiple configurations and indexes to handle whatever subset of the available data you wish to make searchable.

There are quite a few more parameters which can be set in the configuration file itself for tailoring Recoll data storage. They are described in a section of the configuration chapter.

The size of the index is determined by the size of the set of documents, but the ratio can vary a lot. For a typical mixed set of documents, the index size will often be close to the data set size. In specific cases (a set of compressed mbox files for example), the index can become much bigger than the documents. It may also be much smaller if the documents contain a lot of images or other non-indexed data (an extreme example being a set of mp3 files where only the tags would be indexed).

Of course, images, sound and video do not increase the index size, which means that in most cases, the space used by the index will be negligible compared to the total amount of data on the computer.

The index data directory (xapiandb) only contains data that can be completely rebuilt by an index run (as long as the original documents exist), and it can always be destroyed safely.

2.2.1. Xapian index formats

Xapian versions usually support several formats for index storage. A given major Xapian version will have a current format, used to create new indexes, and will also support the format from the previous major version.

Xapian will not convert automatically an existing index from the older format to the newer one. If you want to upgrade to the new format, or if a very old index needs to be converted because its format is not supported any more, you will have to explicitly delete the old index (typically ~/.recoll/xapiandb), then run a normal indexing command. Using recollindex option -z would not work in this situation.

2.2.2. Security aspects

The Recoll index does not hold complete copies of the indexed documents (it almost does after version 1.24). But it does hold enough data to allow for an almost complete reconstruction. If confidential data is indexed, access to the database directory should be restricted.

Recoll will create the configuration directory with a mode of 0700 (access by owner only). As the index data directory is by default a sub-directory of the configuration directory, this should result in appropriate protection.

If you use another setup, you should think of the kind of protection you need for your index, set the directory and files access modes appropriately, and also maybe adjust the umask used during index updates.

2.2.3. Special considerations for big indexes

This only needs concern you if your index is going to be bigger than around 5 GBytes. Beyond 10 GBytes, it becomes a serious issue. Most people have much smaller indexes. For reference, 5 GBytes would be around 2000 bibles, a lot of text. If you have a huge text dataset (remember: images don't count, the text content of PDFs is typically less than 5% of the file size), read on.

The amount of writing performed by Xapian during index creation is not linear with the index size (it is somewhere between linear and quadratic). For big indexes this becomes a performance issue, and may even be an SSD disk wear issue.

The problem can be mitigated by using the following approaches:

  • Partition the data set and create several indexes of reasonable size rather than a huge one. These indexes can then be queried in parallel (using the Recoll external indexes facility), or merged using xapian-compact.

  • Have a lot of RAM available and set the idxflushmb Recoll configuration parameter as high as you can without swapping (experimentation will be needed). 200 would be a minimum in this context.

  • Use Xapian 1.4.10 or newer, as this version brought a significant improvement in the amount of writes.

Recoll versions 1.38 and newer have an option to use multiple temporary indexes and a final merge internally. This was designed as a CPU performance optimization (increasing parallelism), but it may also provide a simple solution for the index size issue, though it may not give enough control over the temporary indexes physical placement for really huge datasets.

2.3. Index configuration

Variables stored inside the Recoll configuration files control which areas of the file system are indexed, and how files are processed. The values can be set by editing the text files. Most of the more commonly used ones can also be adjusted by using the dialogs in the recoll GUI.

The first time you start recoll, you will be asked whether or not you would like it to build the index. If you want to adjust the configuration before indexing, just click Cancel at this point, which will get you into the configuration interface. If you exit at this point, recoll will have created a default configuration directory with empty configuration files, which you can then edit.

The configuration is documented inside the installation chapter of this document, or in the recoll.conf(5) manual page. Both documents are automatically generated from the comments inside the configuration file.

The most immediately useful variable is topdirs, which lists the subtrees and files to be indexed. The variable name is a bit misleading for native English speakers, so the corresponding GUI label is Start folders.

The applications needed to index file types other than text, HTML or email (e.g.: pdf, postscript, ms-word...) are described in the external packages section.

There are two incompatible types of Recoll indexes, depending on the treatment of character case and diacritics. A further section describes the two types in more detail. The default type is appropriate in most cases.

2.3.1. The index configuration GUI

Most index configuration parameters can be set from the recoll GUI (set RECOLL_CONFDIR or use the -c option to affect a non-default index.)

The interface is started from the PreferencesIndex Configuration menu entry. It is divided in four tabs, Global parameters, Local parameters, Web history (details) and Search parameters.

The Global parameters tab allows setting global variables, like the lists of top/start directories, skipped paths, or stemming languages.

The Local parameters tab allows setting variables that can be redefined for subdirectories. This second tab has an initially empty list of customisation directories, to which you can add. The variables are then set for the currently selected directory (or at the top level if the empty line is selected).

The Search parameters section defines parameters which are used at query time, but are global to an index and affect all search tools, not only the GUI.

The meaning for most entries in the interface is self-evident and documented by a ToolTip popup on the text label. For more detail, you may need to refer to the configuration section of this guide.

The configuration tool normally respects the comments and most of the formatting inside the configuration file, so that it is quite possible to use it on hand-edited files, which you might nevertheless want to backup first...

2.3.2. Multiple indexes

Multiple Recoll indexes can be created by using several configuration directories which would typically be set to index different areas of the file system.

A specific configuration can be selected by setting the RECOLL_CONFDIR environment variable or giving the -c option to recoll and recollindex.

The recollindex program, used for creating or updating indexes, always works on a single index. The different configurations are entirely independent (no parameters are ever shared between configurations when indexing).

All the search interfaces (recoll, recollq, the Python API, etc.) operate with a main configuration, from which both configuration and index data are used, and can also query data from multiple additional indexes. Only the index data from additional indexes is used, their configuration parameters are ignored. This implies that some parameters should be consistent among index configurations which are to be used together.

When searching, the current main index (defined by RECOLL_CONFDIR or -c) is always active. If this is undesirable, you can set up your base configuration to index an empty directory.

Index configuration parameters can be set either by using a text editor on the files, or, for most parameters, by using the recoll index configuration GUI. In the latter case, the configuration directory for which parameters are modified is the one which was selected by RECOLL_CONFDIR or the -c parameter, and there is no way to switch configurations within the GUI.

See the configuration section for a detailed description of the parameters

Some configuration parameters must be consistent among a set of multiple indexes used together for searches. Most importantly, all indexes to be queried concurrently must have the same option concerning character case and diacritics stripping, but there are other constraints. Most of the relevant parameters affect the term generation.

Using multiple configurations implies a small level of command line or file manager usage. The user must explicitly create additional configuration directories, the GUI will not do it. This is to avoid mistakenly creating additional directories when an argument is mistyped. Also, the GUI or the indexer must be launched with a specific option or environment to work on the right configuration.

Creating and using an additional index: Linux example

The following applies to Unix-like systems

Initially creating the configuration and index:

mkdir /path/to/my/new/config

Configuring the new index can be done from the recoll GUI, launched from the command line to pass the -c option (you could create a desktop file to do it for you), and then using the GUI index configuration tool to set up the index.

recoll -c /path/to/my/new/config

Alternatively, you can just start a text editor on the main configuration file:

someEditor /path/to/my/new/config/recoll.conf

Creating and updating the index can be done from the command line:

recollindex -c /path/to/my/new/config

or from the File menu of a GUI launched with the same option (recoll, see above).

The same GUI would also let you set up batch indexing for the new index. Real time indexing can only be set up from the GUI for the default index (the menu entry will be inactive if the GUI was started with a non-default -c option).

The new index can be queried alone with:

recoll -c /path/to/my/new/config

Or, in parallel with the default index, by starting recoll without a -c option, and using the External Indexes tab in the preferences dialog, which can be reached either trough: PreferencesGUI ConfigurationExternal Index Dialog or QueryExternal index dialog. See the GUI external indexes section for more details.

Creating an alternate index: Windows example

When running Recoll under Windows, the simplest approach for using separate indexes is to start the GUI from different desktop icons. The following approach can be used:

  1. Create an empty folder somewhere for holding the new configuration and index.

  2. Select the Recoll icon on the desktop and Copy/Paste it. If no desktop icon was created during installation, you can right-drag the recoll.exe program from C:\Program Files (X86)\Recoll to the desktop and select Create shortcuts here to create one.

  3. Right-click the new shortcut and go to the Properties->shortcut tab

  4. Modify the Target value from the original C:\Program Files (x86)\Recoll\recoll.exe to something like:

    "C:\Program Files (x86)\Recoll\recoll.exe" -c C:\Path\To\My\New\Directory

    Use double quotes around the directory path is it contains spaces.

  5. Then save the new Icon by clicking ok, and double click it to start a Recoll GUI for the new configuration. You should be presented with the initial configuration dialog.

Any other method for running the GUI or recollindex program with a -c option or a RECOLL_CONFDIR value in the environment would work too.

2.3.3. Index case and diacritics sensitivity

As of Recoll version 1.18 you have a choice of building an index with terms stripped of character case and diacritics, or one with raw terms. For a source term of Résumé, the former will store resume, the latter Résumé.

Each type of index allows performing searches insensitive to case and diacritics: with a raw index, the user entry will be expanded to match all case and diacritics variations present in the index. With a stripped index, the search term will be stripped before searching.

A raw index allows using case and diacritics to discriminate between terms, e.g., returning different results when searching for US and us or resume and résumé. Read the section about search case and diacritics sensitivity for more details.

The type of index to be created is controlled by the indexStripChars configuration variable which can only be changed by editing the configuration file. Any change implies an index reset (not automated by Recoll), and all indexes in a search must be set in the same way (again, not checked by Recoll).

Recoll creates a stripped index by default if indexStripChars is not set.

As a cost for added capability, a raw index will be slightly bigger than a stripped one (around 10%). Also, searches will be more complex, so probably slightly slower, and the feature is relatively little used, so that a certain amount of weirdness cannot be excluded.

One of the most adverse consequence of using a raw index is that some phrase and proximity searches may become impossible: because each term needs to be expanded, and all combinations searched for, the multiplicative expansion may become unmanageable.

2.4. Indexing performance and resource usage

2.4.1. Indexing threads configuration (Unix-like systems)

Note: you don't probably don't need to read this. The default automatic configuration is fine is most cases. Only the part about disabling multithreading may be more commonly useful, so I'll prepend it here. In recoll.conf:

            thrQSizes = -1 -1 -1
          

The Recoll indexing process recollindex can use multithreading to speed up indexing on multiprocessor systems. This is currently enabled on MacOS systems and Unix-like systems systems, but not under Windows.

The data processing used to index files is divided in several stages and some of the stages can be executed by multiple threads. The stages are:

  1. File system walking: this is always performed by the main thread.

  2. File conversion and data extraction.

  3. Text processing (splitting, stemming, etc.).

  4. Xapian index update.

You can also read a longer document about the transformation of Recoll indexing to multithreading.

The threads configuration is controlled by two configuration file parameters.

thrQSizes

This variable defines the job input queues configuration. There are three possible queues for stages 2, 3 and 4, and this parameter should give the queue depth for each stage (three integer values). If a value of -1 is used for a given stage, no queue is used, and the thread will go on performing the next stage. In practise, deep queues have not been shown to increase performance. A value of 0 for the first queue tells Recoll to perform autoconfiguration (no need for anything else in this case, thrTCounts is not used) - this is the default configuration.

thrTCounts

This defines the number of threads used for each stage. If a value of -1 is used for one of the queue depths, the corresponding thread count is ignored. It makes no sense to use a value other than 1 for the last stage because updating the Xapian index is necessarily single-threaded (and protected by a mutex).

Note

If the first value in thrQSizes is 0, thrTCounts is ignored.

The following example would use three queues (of depth 2), and 4 threads for converting source documents, 2 for processing their text, and one to update the index. This was tested to be the best configuration on the test system (quadri-processor with multiple disks).

            thrQSizes = 2 2 2
            thrTCounts =  4 2 1
          

The following example would use a single queue, and the complete processing for each document would be performed by a single thread (several documents will still be processed in parallel in most cases). The threads will use mutual exclusion when entering the index update stage. In practise the performance would be close to the precedent case in general, but worse in certain cases (e.g. a Zip archive would be performed purely sequentially), so the previous approach is preferred. YMMV... The 2 last values for thrTCounts are ignored.

            thrQSizes = 2 -1 -1
            thrTCounts =  6 1 1
          

The following example would disable multithreading. Indexing will be performed by a single thread.

thrQSizes = -1 -1 -1

2.4.2. Using multiple temporary indexes to improve indexing time (1.41.1)

Note

The underlying code is buggy between 1.38 and 1.41.0, fixed in 1.41.1. The bug affects the storing of document texts inside the index, so it only affects snippets generation inside result lists. If the result lists snippets are important to you, do not use the function with an affected release.

In some cases, either when the input documents are simple and require little processing (e.g. HTML files), or possibly with a high number of available cores, the single-threaded Xapian index updates can become the performance bottleneck for indexing.

In this case, it is possible to configure the indexer to use multiple temporary indexes which are merged at the end of the operation. This can provide a huge gain in performance, but, as opposed to multithreading for document preparation, it can also have a (slight) negative impact in some cases, so that it is not enabled by default.

In most cases, this should also be turned off after the initial index creation is done, because it is extremely detrimental to the speed of small incremental updates.

The parameter which controls the number of temporary indexes in recoll.conf is named thrTmpDbCnt. The default value is 0, meaning that no temporary indexes are used.

If your document set is big, and you are using a processor with many cores for indexing, especially if the input documents are simple, it may be worth it to experiment with the value. For example, with a partial Wikipedia dump (many HTML small files), indexing times could be divided almost by three, by using four temporary indexes on a quad-core machine. More detail in this article on the Recoll WEB site.

All the tests were performed on SSDs, it is quite probable that this approach would not work well on spinning disks, at least not in its current form.

2.4.3. Quieting down the indexing process

The Recoll indexing process, recollindex is usually configured to have very low priority and not disturb other activity on the machine. Still, on an idle system, even with multithreading disabled, it will use 100% of one core if needed and available. This may be enough to get a laptop fan to spin up in some cases. To prevent this, we want to limit the CPU utilisation for every short time quanta (e.g. not more than 20 mS for every 100 mS).

This would be extremely difficult to do from inside the indexing process, because of the many places where intensive CPU usage takes place, some not under our control (Xapian or external helpers). Happily enough, on Linux systems, you can use the cgroup facility to throttle the process CPU usage. This is further documented on the Recoll WEB site

2.5. Index update scheduling

2.5.1. Periodic indexing

Running the indexer

The recollindex program performs index updates. You can start it either from the command line or from the File menu in the recoll GUI program. When started from the GUI, the indexing will run on the same configuration recoll was started on. When started from the command line, recollindex will use the RECOLL_CONFDIR variable or accept a -c confdir option to specify a non-default configuration directory.

If the recoll program finds no index when it starts, it will automatically start indexing (except if canceled).

The GUI File menu has entries to start or stop the current indexing operation. When indexing is not currently running, you have a choice between Update Index or Rebuild Index. The first choice only processes changed files, the second one erases the index before starting so that all files are processed.

On Linux and Windows, the GUI can be used to manage the indexing operation. Stopping the indexer can be done from the recoll GUI FileStop Indexing menu entry.

On Linux, the recollindex indexing process can be interrupted by sending an interrupt (Ctrl-C, SIGINT) or terminate (SIGTERM) signal.

When stopped, some time may elapse before recollindex exits, because it needs to properly flush and close the index.

After an interruption, the index will be somewhat inconsistent because some operations which are normally performed at the end of the indexing pass will have been skipped (for example, the stemming and spelling databases will be inexistent or out of date). You just need to restart indexing at a later time to restore consistency. The indexing will restart at the interruption point (the full file tree will be traversed, but files that were indexed up to the interruption and for which the index is still up to date will not need to be reindexed).

recollindex command line

recollindex has many options which are listed in its manual page. Only a few will be described here.

Option -z will reset the index when starting. This is almost the same as destroying the index files (the nuance is that the Xapian format version will not be changed).

Option -Z will force the update of all documents without resetting the index first. This will not have the "clean start" aspect of -z, but the advantage is that the index will remain available for querying while it is rebuilt, which can be a significant advantage if it is very big (some installations need days for a full index rebuild).

Option -k will force retrying files which previously failed to be indexed, for example because of a missing helper program.

Of special interest also, maybe, are the -i and -f options. -i allows indexing an explicit list of files (given as command line parameters or read on stdin). -f tells recollindex to ignore file selection parameters from the configuration. Together, these options allow building a custom file selection process for some area of the file system, by adding the top directory to the skippedPaths list and using an appropriate file selection method to build the file list to be fed to recollindex -if. Trivial example:

    find . -name indexable.txt -print | recollindex -if

recollindex -i will not descend into subdirectories specified as parameters, but just add them as index entries. It is up to the external file selection method to build the complete file list.

Linux: using cron to automate indexing

The most common way to set up indexing is to have a cron task execute it every night. For example the following crontab entry would do it every day at 3:30AM (supposing recollindex is in your PATH):

30 3 * * * recollindex > /some/tmp/dir/recolltrace 2>&1

Or, using anacron:

1  15  su mylogin -c "recollindex recollindex > /tmp/rcltraceme 2>&1"

The Recoll GUI has dialogs to manage crontab entries for recollindex. You can reach them from the PreferencesIndexing Schedule menu. They only work with the good old cron, and do not give access to all features of cron scheduling. Entries created via the tool are marked with a RCLCRON_RCLINDEX= marker so that the tool knows which entries belong to it. As a side effect, this sets an environment variable for the process, but it's not actually used, this is just a marker.

The usual command to edit your crontab is crontab -e (which will usually start the vi editor to edit the file). You may have more sophisticated tools available on your system.

Please be aware that there may be differences between your usual interactive command line environment and the one seen by crontab commands. Especially the PATH variable may be of concern. Please check the crontab manual pages about possible issues.

2.5.2. Real time indexing

Real time monitoring/indexing is performed by starting the recollindex -m command. With this option, recollindex will permanently monitor file changes and update the index.

On Windows systems, the monitoring process is started from the recoll GUI File menu. On Unix-like systems, there are other possibilities, see the following sections.

When this is in use, the recoll GUI File menu makes two operations available: Stop and Trigger incremental pass.

Trigger incremental pass has the same effect as restarting the indexer, and will cause a complete walk of the indexed area, processing the changed files, then switch to monitoring. This is only marginally useful, maybe in cases where the indexer is configured to delay updates, or to force an immediate rebuild of the stemming and phonetic data, which are only processed at intervals by the real time indexer.

While it is convenient that data is indexed in real time, repeated indexing can generate a significant load on the system when files such as email folders change. Also, monitoring large file trees by itself significantly taxes system resources. You probably do not want to enable it if your system is short on resources. Periodic indexing is adequate in most cases.

As of Recoll 1.24, you can set the monitordirs configuration variable to specify that only a subset of your indexed files will be monitored for instant indexing. In this situation, an incremental pass on the full tree can be triggered by either restarting the indexer, or just running recollindex, which will notify the running process. The recoll GUI also has a menu entry for this.

Unix-like systems: automatic daemon start with systemd

The installation contains two example files (in share/recoll/examples) for starting the indexing daemon with systemd.

recollindex.service would be used for starting recollindex as a user service. The indexer will start when the user logs in and run while there is a session open for them.

recollindex@.service is a template service which would be used for starting the indexer at boot time, running as a specific user. It can be useful when running the text search as a shared service (e.g. when users access it through the WEB UI).

If configured to do so, the unit files should have been installed in your system's default systemd paths (usually /usr/lib/systemd/system/ and /usr/lib/systemd/user/). If not, you may need to copy the files there before starting the service.

With the unit files installed in the proper location, the user unit can be started with the following commands:

systemctl --user daemon-reload
systemctl --user enable --now recollindex.service

The system unit file can be enabled for a particular user by running, as root:

systemctl daemon-reload
systemctl enable --now recollindex@username.service

(A valid user name should be substituted for username, of course.)

Unix-like systems: automatic daemon start from the desktop session

Under KDE, Gnome and some other desktop environments, the daemon can automatically started when you log in, by creating a desktop file inside the ~/.config/autostart directory. This can be done for you by the Recoll GUI. Use the Preferences->Indexing Schedule menu.

With older X11 setups, starting the daemon is normally performed as part of the user session script.

The rclmon.sh script can be used to easily start and stop the daemon. It can be found in the examples directory (typically /usr/local/[share/]recoll/examples).

For example, a good old xdm-based session could have a .xsession script with the following lines at the end:

recollconf=$HOME/.recoll-home
recolldata=/usr/local/share/recoll
RECOLL_CONFDIR=$recollconf $recolldata/examples/rclmon.sh start

fvwm

The indexing daemon gets started, then the window manager, for which the session waits.

By default the indexing daemon will monitor the state of the X11 session, and exit when it finishes, it is not necessary to kill it explicitly. (The X11 server monitoring can be disabled with option -x to recollindex).

If you use the daemon completely out of an X11 session, you need to add option -x to disable X11 session monitoring (else the daemon will not start).

Miscellaneous details

Logging. By default, the messages from the indexing daemon will be sent to the same file as those from the interactive commands (logfilename). You may want to change this by setting the daemlogfilename and daemloglevel configuration parameters. Also the log file will only be truncated when the daemon starts. If the daemon runs permanently, the log file may grow quite big, depending on the log level.

Unix-like systems: increasing resources for inotify. On Linux systems, monitoring a big tree may need increasing the resources available to inotify, which are normally defined in /etc/sysctl.conf.

### inotify
#
# cat  /proc/sys/fs/inotify/max_queued_events   - 16384
# cat  /proc/sys/fs/inotify/max_user_instances  - 128
# cat  /proc/sys/fs/inotify/max_user_watches    - 16384
#
# -- Change to:
#
fs.inotify.max_queued_events=32768
fs.inotify.max_user_instances=256
fs.inotify.max_user_watches=32768

Especially, you will need to trim your tree or adjust the max_user_watches value if indexing exits with a message about errno ENOSPC (28) from inotify_add_watch.

Slowing down the reindexing rate for fast changing files. When using the real time monitor, it may happen that some files need to be indexed, but change so often that they impose an excessive load for the system. Recoll provides a configuration option to specify the minimum time before which a file, specified by a wildcard pattern, cannot be reindexed. See the mondelaypatterns parameter in the configuration section.

2.6. Fields and metadata

Apart from the main text content, documents usually aggregate other data elements, such as an author names, dates, abstracts, etc. These are usually called metadata elements because they qualify or describe the data rather than being part of it. Recoll has a slightly more general notion of field to mean any named piece of data associated with a document.

Fields are extracted by the document handlers when processing a document and further used by Recoll for searching or displaying results.

Some fields, like e.g. a file modification time, have a strict and predefined usage. For most fields though, the processing is entirely configurable and defined in the fields configuration file

Fields have two main processing options (at least one of which will be set if they are processed at all):

  • Their content can be indexed. This makes them searchable.

  • Their content can be stored in the index as document attribute data. This makes them displayable as part of a result list entry.

These options are preset in the default fields file for common elements like a title or an author name.

The terms from indexed fields are stored in the inverted index with a specific prefix, which makes them searchable by specifying the field name (e.g. author:Balzac). The terms can optionally also be used for the main index section to provide hits for non-prefixed searches. This is decided by an attribute in the fields file.

In most cases, field data is provided by the document itself, for example, by HTML <meta> elements. They can also be obtained from other sources, this is described in the following section.

2.6.1. Incorporating external metadata

Unix-like systems and MacOS systems: using extended attributes

User extended attributes are named pieces of information that most modern file systems can attach to any file.

Recoll processes all extended attributes as document fields. Note that most fields are not indexed by default, you need to activate them by defining a prefix in the fields configuration file.

A freedesktop standard defines a few special attributes, which are handled as such by Recoll:

mime_type

If set, this overrides any other determination of the file MIME type.

charset

If set, this defines the file character set (mostly useful for plain text files).

By default, other attributes are handled as Recoll fields of the same name.

On Linux, the user prefix is removed from the name.

The name translation can be configured more precisely, inside the fields configuration file.

Setting the document modification/creation date

Some documents have an internal date attribute (e.g. emails), but most get their date from the file modification time. It is possible to set a document date different from the file's by setting a specific extended attribute. For obscure and uninteresting reasons, the harcoded name of the attribute is modificationdate. Its contents should be the ASCII representation of a decimal integer representing the Unix time (seconds since the epoch). An example Linux command line for setting this particular field follow. The substituted date prints the example date parameter in Unix time format (seconds since the epoch).

          setfattr -n user.modificationdate -v `date -d '2022-09-30 08:30:00' +%s` /some/file

The date substitution will then be automatic, you do not need to customise the fields file.

Using a command for importing external metadata

During indexing, it is possible to import metadata for each file by executing commands. This allows, for example, extracting tag data from an external application and storing it in a field for indexing.

See the section about the metadatacmds field in the main configuration chapter for a description of the configuration syntax.

For example, if you would want Recoll to use tags managed by tmsu in a field named tags, you would add the following to the configuration file:

[/some/area/of/the/fs]
metadatacmds = ; tags = tmsu tags %f

Note the initial semi-colon after the equal sign.

You may want to restrict this processing to a subset of the directory tree, because it may slow down indexing a bit ([some/area/of/the/fs]).

In the example above, the output of tmsu is used to set a field named tags. The field name is arbitrary and could be tmsu or myfield just the same, but tags is an alias for the standard Recoll keywords field, and the tmsu output will just augment its contents. This will avoid the need to extend the field configuration.

Note

Depending on the tmsu version, you may need/want to add options like --database=/some/db.

After setting or updating the parameter, you will need to tell Recoll to reindex the affected files. Just reset the index or see recollindex options -e or -r.

You will then be able to search the field from the query language: tags:some/alternate/values or tags:all,these,values.

Tags changes will not be detected by the indexer if the file itself did not change. One possible workaround would be to update the file ctime when you modify the tags, which would be consistent with how extended attributes function. A pair of chmod commands could accomplish this, or a touch -a. Alternatively, just couple the tag update with a recollindex -e -i /path/to/the/file.

2.7. Miscellaneous indexing notes

2.7.1. Indexing punctuation characters (1.39)

By default, the Recoll indexer only uses most non-alphanumeric characters as separators, treating them as white space, so that inputs like all words, and all,words produce the same terms.

It may sometimes be useful to index some of these characters so that they can be used as discriminants for searches. This can be done by setting the indexedpunctuation configuration parameter. The value is an UTF-8 string, for example, setting:

indexedpunctuation = %€

would allow searching separately 100% or 100€.

The affected characters are indexed as terms with their own term positions, and they are their own separators, so that 100% and 100 % would be equivalent inputs.

2.7.2. The PDF input handler

The PDF format is very important for scientific and technical documentation, and document archival. It has extensive facilities for storing metadata along with the document, and these facilities are actually used in the real world.

In consequence, the rclpdf.py PDF input handler has more complex capabilities than most others, and it is also more configurable, because some extra features need executing external commands, so that they are not enabled by default. Specifically, rclpdf.py has the following optional features:

  • It can extract PDF outlines and bookmarks.

  • It can be configured to extract specific metadata tags from an XMP packet.

  • It can extract PDF attachments.

  • It can automatically perform OCR if the document text is empty. This is done by executing an external program and is now described in a separate section, because the OCR framework can also be used with non-PDF image files.

Extracting PDF outlines and bookmarks

These data elements will be extracted if pdfoutline is set in the configuration file and the pdftohtml command (from poppler-tools is available). Executing the command takes extra time, which is why the feature is not enabled by default.

XMP fields extraction

The rclpdf.py script in Recoll version 1.23.2 and later can extract XMP metadata fields by executing the pdfinfo command (usually found with poppler-utils). This is controlled by the pdfextrameta configuration variable, which specifies which tags to extract and, possibly, how to rename them.

The pdfextrametafix variable can be used to designate a file with Python code to edit the metadata fields (available for Recoll 1.23.3 and later. 1.23.2 has equivalent code inside the handler script). Example:

import sys
import re

class MetaFixer(object):
def __init__(self):
pass

def metafix(self, nm, txt):
if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt)
elif nm == 'someothername':
# do something else
pass
elif nm == 'stillanother':
# etc.
pass

return txt
def wrapup(self, metaheaders):
pass

If the 'metafix()' method is defined, it is called for each metadata field. A new MetaFixer object is created for each PDF document (so the object can keep state for, for example, eliminating duplicate values). If the 'wrapup()' method is defined, it is called at the end of XMP fields processing with the whole metadata as parameter, as an array of '(nm, val)' pairs, allowing an alternate approach for editing or adding/deleting fields.

See this page for a more detailed discussion about indexing PDF XMP properties.

PDF attachment indexing

If pdftk is installed, and if the the pdfattach configuration variable is set, the PDF input handler will try to extract PDF attachments for indexing as sub-documents of the PDF file. This is disabled by default, because it slows down PDF indexing a bit even if not one attachment is ever found (PDF attachments are uncommon in my experience).

2.7.3. Running OCR on image documents

The Recoll PDF handler has the ability to call an external OCR program if the processed file has no text content. The OCR data is stored in a cache of separate files, avoiding any modification of the originals.

It must be noted that, if modifying the files (or a copy) is acceptable, then running something like OCRmyPDF to add a text layer to the PDF itself is a better solution (e.g. allowing Recoll to position the PDF viewer on the search target when opening the document, and permitting secondary search in the native tool).

To enable the Recoll OCR feature, you need to install one of the supported OCR applications (tesseract or ABBYY), enable OCR in the PDF handler (by setting pdfocr to 1 in the index configuration file), and tell Recoll how to run the OCR by setting configuration variables. All parameters can be localized in subdirectories through the usual main configuration mechanism (path sections).

Example configuration fragment in recoll.conf:

pdfocr = 1
ocrprogs = tesseract
pdfocrlang = eng

This facility got a major update in Recoll 1.26.5. Older versions had a more limited, non-caching capability to execute an external OCR program in the PDF handler. The new function has the following features:

  • The OCR output is cached, stored as separate files. The caching is ultimately based on a hash value of the original file contents, so that it is immune to file renames. A first path-based layer ensures fast operation for unchanged (unmoved files), and the data hash (which is still orders of magnitude faster than OCR) is only re-computed if the file has moved. OCR is only performed if the file was not previously processed or if it changed.

  • The support for a specific program is implemented in a simple Python module. It should be straightforward to add support for any OCR engine with a capability to run from the command line.

  • Modules initially exist for tesseract (Linux and Windows), and ABBYY FineReader (Linux, tested with version 11). ABBYY FineReader is a commercial closed source program, but it sometimes perform better than tesseract.

  • The OCR is currently only called from the PDF handler, but there should be no problem using it for other image types.

2.7.4. Running a speech to text program on audio files

If the OpenAI Whisper program is available and the appropriate parameters set in the configuration files, the Recoll audio file handler will run speech to text recognition on audio files and the resulting text will be indexed. See the the FAQ entry for more details.

The results of the speech recognition will be cached in the same manner as the results of image OCR.

2.7.5. Removable volumes

Recoll used to have no support for indexing removable volumes (portable disks, USB keys, etc.). Recent versions have improved the situation and support indexing removable volumes in two different ways:

  • By indexing the volume in the main, fixed, index, and ensuring that the volume data is not purged if the indexing runs while the volume is mounted. (since Recoll 1.25.2).

  • By storing a volume index on the volume itself (since Recoll 1.24).

Indexing removable volumes in the main index

As of version 1.25.2, Recoll provides a simple way to ensure that the index data for an absent volume will not be purged. Two conditions must be met:

  • The volume mount point must be a member of the topdirs list.

  • The mount directory must be empty (when the volume is not mounted).

If recollindex finds that one of the topdirs is empty when starting up, any existing data for the tree will be preserved by the indexing pass (no purge for this area).

Self contained volumes

As of Recoll 1.24, it has become possible to build self-contained datasets including a Recoll configuration directory and index together with the indexed documents, and to move such a dataset around (for example copying it to an USB drive), without having to adjust the configuration for querying the index.

Note

This is a query-time feature only. The index must only be updated in its original location. If an update is necessary in a different location, the index must be reset.

The principle of operation is that the configuration stores the location of the original configuration directory, which must reside on the movable volume. If the volume is later mounted elsewhere, Recoll adjusts the paths stored inside the index by the difference between the original and current locations of the configuration directory.

To make a long story short, here follows a script to create a Recoll configuration and index under a given directory (given as single parameter). The resulting data set (files + recoll directory) can later to be moved to a CDROM or thumb drive. Longer explanations come after the script.

#!/bin/sh

fatal()
{
echo $*;exit 1
}
usage()
{
fatal "Usage: init-recoll-volume.sh <top-directory>"
}

test $# = 1 || usage
topdir=$1
test -d "$topdir" || fatal $topdir should be a directory

confdir="$topdir/recoll-config"
test ! -d "$confdir" || fatal $confdir should not exist

mkdir "$confdir"
cd "$topdir"
topdir=`pwd`
cd "$confdir"
confdir=`pwd`

(echo topdirs = '"'$topdir'"'; \
echo orgidxconfdir = $topdir/recoll-config) > "$confdir/recoll.conf"

recollindex -c "$confdir"

The examples below will assume that you have a dataset under /home/me/mydata/, with the index configuration and data stored inside /home/me/mydata/recoll-confdir.

In order to be able to run queries after the dataset has been moved, you must ensure the following:

  • The main configuration file must define the orgidxconfdir variable to be the original location of the configuration directory (orgidxconfdir=/home/me/mydata/recoll-confdir must be set inside /home/me/mydata/recoll-confdir/recoll.conf in the example above).

  • The configuration directory must exist with the documents, somewhere under the directory which will be moved. E.g. if you are moving /home/me/mydata around, the configuration directory must exist somewhere below this point, for example /home/me/mydata/recoll-confdir, or /home/me/mydata/sub/recoll-confdir.

  • You should keep the default locations for the index elements which are relative to the configuration directory by default (principally dbdir). Only the paths referring to the documents themselves (e.g. topdirs values) should be absolute (in general, they are only used when indexing anyway).

Only the first point needs an explicit user action, the Recoll defaults are compatible with the third one, and the second is natural.

If, after the move, the configuration directory needs to be copied out of the dataset (for example because the thumb drive is too slow), you can set the curidxconfdir, variable inside the copied configuration to define the location of the moved one. For example if /home/me/mydata is now mounted onto /media/me/somelabel, but the configuration directory and index has been copied to /tmp/tempconfig, you would set curidxconfdir to /media/me/somelabel/recoll-confdir inside /tmp/tempconfig/recoll.conf. orgidxconfdir would still be /home/me/mydata/recoll-confdir in the original and the copy.

If you are regularly copying the configuration out of the dataset, it will be useful to write a script to automate the procedure. This can't really be done inside Recoll because there are probably many possible variants. One example would be to copy the configuration to make it writable, but keep the index data on the medium because it is too big - in this case, the script would also need to set dbdir in the copied configuration.

The same set of modifications (Recoll 1.24) has also made it possible to run queries from a readonly configuration directory (with slightly reduced function of course, such as not recording the query history).

2.7.6. Unix-like systems: indexing visited Web pages

With the help of a Firefox extension, Recoll can index the Internet pages that you visit. The extension has a long history: it was initially designed for the Beagle indexer, then adapted to Recoll and the Firefox XUL API. The current version of the extension is located in the Mozilla add-ons repository uses the WebExtensions API, and works with current Firefox versions.

The extension works by copying visited Web pages to an indexing queue directory, which Recoll then processes, storing the data into a local cache, then indexing it, then removing the file from the queue.

The local cache is not an archive

As mentioned above, a copy of the indexed Web pages is retained by Recoll in a local cache (from which data is fetched for previews, or when resetting the index). The cache is not changed by an index reset, just read for indexing. The cache has a maximum size, which can be adjusted from the Index configuration / Web history panel (webcachemaxmbs parameter in recoll.conf). Once the maximum size is reached, old pages are erased to make room for new ones. The pages which you want to keep indefinitely need to be explicitly archived elsewhere. Using a very high value for the cache size can avoid data erasure, but see the above 'Howto' page for more details and gotchas.

The visited Web pages indexing feature can be enabled on the Recoll side from the GUI Index configuration panel, or by editing the configuration file (set processwebqueue to 1).

The Recoll GUI has a tool to list and edit the contents of the Web cache. (ToolsWebcache editor)

The recollindex command has two options to help manage the Web cache:

  • --webcache-compact will recover the space from erased entries. It may need to use twice the disk space currently needed for the Web cache.

  • --webcache-burst destdir will extract all current entries into pairs of metadata and data files created inside destdir

You can find more details on Web indexing, its usage and configuration in a Recoll 'Howto' entry.

Chapter 3. Searching

3.1. Introduction

Getting answers to specific queries is of course the whole point of Recoll. The multiple provided interfaces always understand simple queries made of one or several words, and return appropriate results in most cases.

In order to make the most of Recoll though, it may be worthwhile to understand how it processes your input. Five different modes exist:

  • In All Terms mode, Recoll looks for documents containing all your input terms.

  • The Query Language mode behaves like All Terms in the absence of special input, but it can also do much more. This is the best mode for getting the most of Recoll. It is usable from all possible interfaces (GUI, command line, WEB UI, ...), and is described here.

  • In Any Term mode, Recoll looks for documents containing any your input terms, preferring those which contain more.

  • In File Name mode, Recoll will only match file names, not content. Using a small subset of the index allows things like left-hand wildcards without performance issues, and may sometimes be useful.

  • The GUI Advanced Search mode is actually not more powerful than the query language, but it helps you build complex queries without having to remember the language, and avoids any interpretation ambiguity, as it bypasses the user input parser.

These five input modes are supported by the different user interfaces which are described in the following sections.

3.2. Searching with the Qt graphical user interface (GUI)

The recoll program provides the main user interface for searching. It is based on the Qt library.

recoll has two search interfaces:

  • Simple search (the default, on the main screen) has a single entry field where you can enter multiple words or a query language query.

  • Advanced search (a panel accessed through the Tools menu or the toolbox bar icon) has multiple entry fields, which you may use to build a logical condition, with additional filtering on file type, location in the file system, modification date, and size.

The Advanced Search tool is easier to use, but not actually more powerful, than the Simple Search in query language mode. Its name is historical, but Assisted Search would probably have been a better designation.

In most text areas, you can enter the terms as you think them, even if they contain embedded punctuation or other non-textual characters (e.g. Recoll can handle things like email addresses).

The main case where you should enter text differently from how it is printed is for east-asian languages (Chinese, Japanese, Korean). Words composed of single or multiple characters should be entered separated by white space in this case (they would typically be printed without white space).

Some searches can be quite complex, and you may want to re-use them later, perhaps with some tweaking. Recoll can save and restore searches. See Saving and restoring queries.

3.2.1. Simple search

  1. Start the recoll program.

  2. Possibly choose a search mode: Any term, All terms, File name or Query language.

  3. Enter search term(s) in the text field at the top of the window.

  4. Click the Search button or hit the Enter key to start the search.

The initial default search mode is Query language. Without special directives, this will look for documents containing all of the search terms (the ones with more terms will get better scores), just like the All Terms mode.

Any term will search for documents where at least one of the terms appear.

File name will exclusively look for file names, not contents

All search modes allow terms to be expanded with wildcards characters (*, ?, []). See the section about wildcards for more details.

In all modes except File name, you can search for exact phrases (adjacent words in a given order) by enclosing the input inside double quotes. Ex: "virtual reality".

The Query Language features are described in a separate section.

When using a stripped index (the default), character case has no influence on search, except that you can disable stem expansion for any term by capitalizing it. E.g.: a search for floor will also normally look for flooring, floored, etc., but a search for Floor will only look for floor, in any character case. Stemming can also be disabled globally in the preferences. When using a raw index, the rules are a bit more complicated.

Recoll remembers the last few searches that you performed. You can directly access the search history by clicking the clock button on the right of the search entry, while the latter is empty. Otherwise, the history is used for entry completion (see next). Only the search texts are remembered, not the mode (all/any/file name).

While text is entered in the search area, recoll will display possible completions, filtered from the history and the index search terms. This can be disabled with a GUI Preferences option.

Double-clicking on a word in the result list or a preview window will insert it into the simple search entry field.

You can cut and paste any text into an All terms or Any term search field, punctuation, newlines and all - except for wildcard characters (single ? characters are ok). Recoll will process it and produce a meaningful search. This is what most differentiates this mode from the Query Language mode, where you have to care about the syntax.

The File name search mode will specifically look for file names. The point of having a separate file name search is that wildcard expansion can be performed more efficiently on a small subset of the index (allowing wildcards on the left of terms without excessive cost). Things to know:

  • White space in the entry should match white space in the file name, and is not treated specially.

  • The search is insensitive to character case and accents, independently of the type of index.

  • An entry without any wildcard character and not capitalized will be prepended and appended with '*' (e.g.: etc -> *etc*, but Etc -> etc).

  • If you have a big index (many files), excessively generic fragments may result in inefficient searches.

3.2.2. The result list

After starting a search, a list of results will instantly be displayed in the main window.

By default, the document list is presented in order of relevance (how well the application estimates that the document matches the query). You can sort the results by ascending or descending date by using the vertical arrows in the toolbar.

Each result is displayed as a structured text paragraph. The standard format is typically adequate, but the content and presentation are entirely customisable.

Most results will contain Preview and Open clickable links.

Clicking the Preview link will open an internal preview window for the document. Further Preview clicks for the same search will open tabs in the existing preview window. You can use Shift+Click to force the creation of another preview window, which may be useful to view the documents side by side. (You can also browse successive results in a single preview window by typing Shift+ArrowUp/Down in the window).

Clicking the Open link will start an external viewer for the document. By default, Recoll lets the desktop choose the appropriate application for most document types. See further for customising the applications.

The Preview and Open links may not be present for all entries. They are only available, respectively, for documents with MIME types that Recoll can extract text from, and for documents that have a configured viewer. However, you can modify the configuration to adjust this behavior. In more detail:

  • The Preview link will appear for documents with a MIME type present in the [index] section of the mimeconf file, and, only if the textunknownasplain configuration variable is set, for all types identified as a subtype of text (text/*).

  • The Open link will appear for documents with a MIME type present in the [view] section of the mimeview configuration file. If textunknownasplain is set and no specific viewer is found for a subtype of text, the viewer for text/plain will be used.

You can click on the Query details link at the top of the results page to see the actual Xapian query, after stem expansion and other processing.

Double-clicking on any word inside the result list or a preview window will insert it into the simple search text.

The result list is divided into pages. You can change the page size in the preferences. Use the arrow buttons in the toolbar or the links at the bottom of the page to browse the results.

No results: the spelling suggestions

When a search yields no result, and if the aspell dictionary is configured, Recoll will try to check for misspellings among the query terms, and will propose lists of replacements. Clicking on one of the suggestions will replace the word and restart the search. You can hold any of the modifier keys (Ctrl, Shift, etc.) while clicking if you would rather stay on the suggestion screen because several terms need replacement.

The result list right-click menu

Apart from the preview and edit links, you can display a pop-up menu by right-clicking over a paragraph in the result list. This menu has the following entries:

  • Preview

  • Open

  • Open With

  • Run Script

  • Copy File Name

  • Copy Url

  • Save to File

  • Find similar

  • Preview Parent document

  • Open Parent document

  • Open Snippets Window

The Preview and Open entries do the same thing as the corresponding links.

Open With (Unix-like systems) lets you open the document with one of the applications claiming to be able to handle its MIME type (the information comes from the .desktop files in /usr/share/applications).

Run Script allows starting an arbitrary command on the result file. It will only appear for results which are top-level files. See further for a more detailed description.

The Copy File Name and Copy Url copy the relevant data to the clipboard, for later pasting.

Save to File allows saving the contents of a result document to a chosen file. This entry will only appear if the document does not correspond to an existing file, but is a subdocument inside such a file (e.g.: an email attachment). It is especially useful to extract attachments with no associated editor.

The Open/Preview Parent document entries allow working with the higher level document (e.g. the email message an attachment comes from). Recoll is sometimes not totally accurate as to what it can or can't do in this area. For example the Parent entry will also appear for an email which is part of an mbox folder file, but you can't actually visualize the mbox (there will be an error dialog if you try).

If the document is a top-level file, Open Parent will start the default file manager on the enclosing filesystem directory.

The Find similar entry will select a number of relevant term from the current document and enter them into the simple search field. You can then start a simple search, with a good chance of finding documents related to the current result. I can't remember a single instance where this function was actually useful to me...

The Open Snippets Window entry will only appear for documents which support page breaks (typically PDF, Postscript, DVI). The snippets window lists extracts from the document, taken around search terms occurrences, along with the corresponding page number, as links which can be used to start the native viewer on the appropriate page. If the viewer supports it, its search function will also be primed with one of the search terms.

3.2.3. The result table

As an alternative to the result list, the results can also be displayed in spreadsheet-like fashion. You can switch to this presentation by clicking the table-like icon in the toolbar (this is a toggle, click again to restore the list).

Clicking on the column headers will allow sorting by the values in the column. You can click again to invert the order, and use the header right-click menu to reset sorting to the default relevance order (you can also use the sort-by-date arrows to do this).

Both the list and the table display the same underlying results. The sort order set from the table is still active if you switch back to the list mode. You can click twice on a date sort arrow to reset it from there.

The header right-click menu allows adding or deleting columns. The columns can be resized, and their order can be changed (by dragging). All the changes are recorded when you quit recoll

Hovering over a table row will update the detail area at the bottom of the window with the corresponding values. You can click the row to freeze the display. The bottom area is equivalent to a result list paragraph, with links for starting a preview or a native application, and an equivalent right-click menu. Typing Esc (the Escape key) will unfreeze the display.

Using Shift-click on a row will display the document extracted text (somewhat like a preview) instead of the document details. The functions of Click and Shift-Click can be reversed in the GUI preferences.

3.2.4. The filters panel

By default, the GUI displays the filters panel on the left of the results area. This is new in version 1.32. You can adjust the width of the panel, and hide it by squeezing it completely. The width will be memorized for the next session.

The panel currently has two areas, for filtering the results by dates, or by filesystem location.

The panel is only active in Query Language search mode, and its effect is to add date: and dir: clauses to the actual search.

The dates filter can be activated by clicking the checkbox. It has two assisted date entry widgets, for the minimum and maximum dates of the search period.

The directory filter displays a subset of the filesystem directories, reduced to the indexed area, as defined by the topdirs list and the name exclusion parameters. Some directories may not be shown at all, depending on their (lack of) indexable content and other indexing parameters. The depth of the displayed tree is limited at 2 levels under the start directories by default. You can change this in the GUI Preferences, User interface panel.

You can independantly select and deselect directories by clicking them. Note that selecting a directory will activate the whole subtree for searching, there is no need to select the subdirectories, and no way to exclude some of them (use Query language dir: clauses if this is needed).

3.2.5. Running arbitrary commands on result files

Apart from the Open and Open With operations, which allow starting an application on a result document (or a temporary copy), based on its MIME type, it is also possible to run arbitrary commands on results which are top-level files, using the Run Script entry in the results pop-up menu.

The commands which will appear in the Run Script submenu must be defined by .desktop files inside the scripts subdirectory of the current configuration directory.

Here follows an example of a .desktop file, which could be named for example, ~/.recoll/scripts/myscript.desktop (the exact file name inside the directory is irrelevant):

          [Desktop Entry]
          Type=Application
          Name=MyFirstScript
          Exec=/home/me/bin/tryscript %F
          MimeType=*/*
        

The Name attribute defines the label which will appear inside the Run Script menu. The Exec attribute defines the program to be run, which does not need to actually be a script, of course. The MimeType attribute is not used, but needs to exist.

The commands defined this way can also be used from links inside the result paragraph.

As an example, it might make sense to write a script which would move the document to the trash and purge it from the Recoll index.

3.2.6. Unix-like systems: displaying thumbnails

The default format for the result list entries and the detail area of the result table display an icon for each result document. The icon is either a generic one determined from the MIME type, or a thumbnail of the document appearance. Thumbnails are only displayed if found in the standard freedesktop location, where they would typically have been created by a file manager.

Recoll has no capability to create thumbnails. A relatively simple trick is to use the Open parent document/folder entry in the result list popup menu. This should open a file manager window on the containing directory, which should in turn create the thumbnails (depending on your settings). Restarting the search should then display the thumbnails.

There are also some pointers about thumbnail generation in the Recoll FAQ.

3.2.7. The preview window

The preview window opens when you first click a Preview link inside the result list.

Subsequent preview requests for a given search open new tabs in the existing window (except if you hold the Shift key while clicking which will open a new window for side by side viewing).

Starting another search and requesting a preview will create a new preview window. The old one stays open until you close it.

You can close a preview tab by typing Ctrl-W (Ctrl + W) in the window. Closing the last tab, or using the window manager button in the top of the frame will also close the window.

You can display successive or previous documents from the result list inside a preview tab by typing Shift+Down or Shift+Up (Down and Up are the arrow keys).

A right-click menu in the text area allows switching between displaying the main text or the contents of fields associated to the document (e.g.: author, abtract, etc.). This is especially useful in cases where the term match did not occur in the main text but in one of the fields. In the case of images, you can switch between three displays: the image itself, the image metadata as extracted by exiftool and the fields, which is the metadata stored in the index.

You can print the current preview window contents by typing Ctrl-P (Ctrl + P) in the window text.

Searching inside the preview

The preview window has an internal search capability, mostly controlled by the panel at the bottom of the window, which works in two modes: as a classical editor incremental search, where we look for the text entered in the entry zone, or as a way to walk the matches between the document and the Recoll query that found it.

Incremental text search

The preview tabs have an internal incremental search function. You initiate the search either by typing a / (slash) or CTL-F inside the text area or by clicking into the Search for: text field and entering the search string. You can then use the Next and Previous buttons to find the next/previous occurrence. You can also type F3 inside the text area to get to the next occurrence.

If you have a search string entered and you use Ctrl-Up/Ctrl-Down to browse the results, the search is initiated for each successive document. If the string is found, the cursor will be positioned at the first occurrence of the search string.

Walking the match lists

If the entry area is empty when you click the Next or Previous buttons, the editor will be scrolled to show the next match to any search term (the next highlighted zone). If you select a search group from the dropdown list and click Next or Previous, the match list for this group will be walked. This is not the same as a text search, because the occurrences will include non-exact matches (as caused by stemming or wildcards). The search will revert to the text mode as soon as you edit the entry area.

3.2.8. The Query Fragments window

The Query Fragments window can be used to control filtering query language elements modifying the current query, simply by clicking a button. This can be useful to save typing, or avoid memorizing, simple clauses of common usage (e.g. selecting only standalone documents or attachments, or filtering out WEB results, selecting a file system subtree, a file type, etc.).

Selecting the ToolsQuery Fragments menu entry will open the dialog.

The contents of the window are entirely customisable, and defined by the contents of a XML text file, named fragment-buttons.xml and which will be looked for in the current index configuration directory. The sample file distributed with Recoll contains a number of example filters. This will be automatically copied to the configuration directory if the file does not exist in there (e.g. ~/.recoll/fragment-buttons.xml under Linux and MacOS, $HOME/AppData/Local/Recoll/fragment-buttons.xml for Windows). Editing the copy will allow you to configure the tool for your needs .

Note

The fragment-buttons.xml file was named fragbuts.xml up to Recoll version 1.31.0. This was deemed too close to offensive for native English speakers, so that the file was renamed. An existing fragbuts.xml will still be used if fragment-buttons.xml does not exist. No automatic renaming will be performed.

Here follows an example window:

And the corresponding configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<fragbuttons version="1.0">

  <radiobuttons>
    <!-- Toggle WEB queue results inclusion -->
    <fragbutton>
      <label>Include Web Results</label>
      <frag></frag>
    </fragbutton>
    <fragbutton>
      <label>Exclude Web Results</label>
      <frag>-rclbes:BGL</frag>
    </fragbutton>
    <fragbutton>
      <label>Only Web Results</label>
      <frag>rclbes:BGL</frag>
    </fragbutton>
  </radiobuttons>

  <radiobuttons>
    <!-- Standalone vs embedded switch -->
    <fragbutton>
      <label>Include embedded documents</label>
      <frag></frag>
    </fragbutton>
    <fragbutton>
      <label>Only standalone documents</label>
      <frag>issub:0</frag>
    </fragbutton>
    <fragbutton>
      <label>Only embedded documents</label>
      <frag>issub:1</frag>
    </fragbutton>
  </radiobuttons>

  <buttons>
    <fragbutton>
      <label>Example: Year 2010</label>
      <frag>date:2010-01-01/2010-12-31</frag>
    </fragbutton>
    <fragbutton>
      <label>Example: c++ files</label>
      <frag>ext:cpp OR ext:cxx</frag>
    </fragbutton>
    <fragbutton>
      <label>Example: My Great Directory</label>
      <frag>dir:/my/great/directory</frag>
    </fragbutton>
  </buttons>
</fragbuttons>
        

There are two types of groupings radiobuttons and buttons, each defining a line of checkbuttons or radiobuttons inside the window. Any number of buttons can be selected, but the radiobuttons in a line are exclusive.

Buttons are defined by a fragbutton section, which provides the label for a button, and the Query Language fragment which will be added (as an AND filter) before performing the query if the button is active.

    <fragbutton>
      <label>Example: My Great Directory</label>
      <frag>dir:/my/great/directory</frag>
    </fragbutton>
  

It is also possible to add message elements inside the groups, for documenting the behaviour. message elements have a label but no frag element. Example:

  <buttons>
    <message>
      <label>This is a message</label> 
    </message>
  </buttons>
  

The label contents are interpreted as HTML. Take care to replace opening < characters with the &lt; entity if you use tags.

The only thing that you need to know about XML for editing this file is that any opening tag like <label> needs to be matched by a closing tag after the value: </label>.

You will normally edit the file with a regular text editor, like, e.g. vi or notepad. Double-clicking the file in a file manager may not work, because this usually opens it in a WEB browser, which will not let you modify the contents.

3.2.9. Assisted Complex Search (A.K.A. "Advanced Search")

The advanced search dialog helps you build more complex queries without memorizing the search language constructs. It can be opened through the Tools menu or through the main toolbar.

Recoll keeps a history of searches. See Advanced search history.

The dialog has two tabs:

  1. The first tab lets you specify terms to search for, and permits specifying multiple clauses which are combined to build the search.

  2. The second tab allows filtering the results according to file size, date of modification, MIME type, or location.

Click on the Start Search button in the advanced search dialog, or type Enter in any text field to start the search. The button in the main window always performs a simple search.

Click on the Show query details link at the top of the result page to see the query expansion.

Advanced search: the "find" tab

This part of the dialog lets you construct a query by combining multiple clauses of different types. Each entry field is configurable for the following modes:

  • All terms.

  • Any term.

  • None of the terms.

  • Phrase (exact terms in order within an adjustable window).

  • Proximity (terms in any order within an adjustable window).

  • Filename search.

Additional entry fields can be created by clicking the Add clause button.

When searching, the non-empty clauses will be combined either with an AND or an OR conjunction, depending on the choice made on the left (All clauses or Any clause).

Entries of all types except "Phrase" and "Near" accept a mix of single words and phrases enclosed in double quotes. Stemming and wildcard expansion will be performed as for simple search.

Phrase and Proximity searches

These two clauses look for a group of terms in specified relative positions. They differ in the sense that the order of input terms is significant for phrase searches, but not for proximity searches. The latter do not impose an order on the words. In both cases, an adjustable number (slack) of non-matched words may be accepted between the searched ones. For phrase searches, the default count is zero (exact match). For proximity searches it is ten (meaning that two search terms, would be matched if found within a window of twelve words).

Examples: a phrase search for quick fox with a slack of 0 will match quick fox but not quick brown fox. With a slack of 1 it will match the latter, but not fox quick. A proximity search for quick fox with the default slack will match the latter, and also a fox is a cunning and quick animal.

The slack can be adjusted with the counter to the left of the input area

Advanced search: the "filter" tab

This part of the dialog has several sections which allow filtering the results of a search according to a number of criteria

  • The first section allows filtering by dates of last modification. You can specify both a minimum and a maximum date. The initial values are set according to the oldest and newest documents found in the index.

  • The next section allows filtering the results by file size. There are two entries for minimum and maximum size. Enter decimal numbers. You can use suffix multipliers: k/K, m/M, g/G, t/T for 10E3, 10E6, 10E9, 10E12 respectively.

  • The next section allows filtering the results by their MIME types, or MIME categories (e.g.: media/text/message/etc.).

    You can transfer the types between two boxes, to define which will be included or excluded by the search.

    The state of the file type selection can be saved as the default (the file type filter will not be activated at program start-up, but the lists will be in the restored state).

  • The bottom section allows restricting the search results to a sub-tree of the indexed area. You can use the Invert checkbox to search for files not in the sub-tree instead. If you use directory filtering often and on big subsets of the file system, you may think of setting up multiple indexes instead, as the performance may be better.

    You can use relative/partial paths for filtering. E.g., entering dirA/dirB would match either /dir1/dirA/dirB/myfile1 or /dir2/dirA/dirB/someother/myfile2.

Advanced search history

The advanced search tool memorizes the last 100 searches performed. You can walk the saved searches by using the up and down arrow keys while the keyboard focus belongs to the advanced search dialog.

The complex search history can be erased, along with the one for simple search, by selecting the FileErase Search History menu entry.

3.2.10. The term explorer tool

Recoll automatically manages the expansion of search terms to their derivatives (e.g.: plural/singular, verb inflections). But there are other cases where the exact search term is not known. For example, you may not remember the exact spelling, or only know the beginning of the name.

The search will only propose replacement terms with spelling variations when no matching document were found. In some cases, both proper spellings and mispellings are present in the index, and it may be interesting to look for them explicitly.

The term explorer tool (started from the toolbar icon or from the Term explorer entry of the Tools menu) can be used to search the full index terms list, or (later addition), display some statistics or other index information. It has several modes of operations:

Wildcard

In this mode of operation, you can enter a search string with shell-like wildcards (*, ?, []). e.g.: xapi* would display all index terms beginning with xapi. (More about wildcards here).

Regular expression

This mode will accept a regular expression as input. Example: word[0-9]+. The expression is implicitly anchored at the beginning. E.g.: press will match pression but not expression. You can use .*press to match the latter, but be aware that this will cause a full index term list scan, which can be quite long.

Stem expansion

This mode will perform the usual stem expansion normally done as part user input processing. As such it is probably mostly useful to demonstrate the process.

Spelling/Phonetic

In this mode, you enter the term as you think it is spelled, and Recoll will do its best to find index terms that sound like your entry. This mode uses the Aspell spelling application, which must be installed on your system for things to work (if your documents contain non-ASCII characters, Recoll needs an aspell version newer than 0.60 for UTF-8 support). The language which is used to build the dictionary out of the index terms (which is done at the end of an indexing pass) is the one defined by your NLS environment. Weird things will probably happen if languages are mixed up.

Show index statistics

This will print a long list of boring numbers about the index

List files which could not be indexed

This will show the files which caused errors, usually because recollindex could not translate their format into text.

Note that in cases where Recoll does not know the beginning of the string to search for (e.g. a wildcard expression like *coll), the expansion can take quite a long time because the full index term list will have to be processed. The expansion is currently limited at 10000 results for wildcards and regular expressions. It is possible to change the limit in the configuration file.

Double-clicking on a term in the result list will insert it into the simple search entry field. You can also cut/paste between the result list and any entry field (the end of lines will be taken care of).

3.2.11. Searching across multiple indexes

See the section describing the use of multiple indexes for generalities. Only the aspects concerning the recoll GUI are described here.

A recoll program instance is always associated with a main index, which is the one to be updated when requested from the File menu, but it can use any number of external Recoll indexes for searching. The external indexes can be selected through the External Indexes tab in the preferences dialog, which can be reached either trough: PreferencesGUI ConfigurationExternal Index Dialog or QueryExternal index dialog.

Index selection is performed in two phases. A set of all usable indexes must first be defined, and then the subset of indexes to be used for searching. These parameters are retained across program executions (there are kept separately for each Recoll configuration). The set of all indexes is usually quite stable, while the active ones might typically be adjusted quite frequently.

The main index (defined by RECOLL_CONFDIR) is always active. If this is undesirable, you can set up your base configuration to index an empty directory.

When adding a new index to the set, you can select either a Recoll configuration directory, or directly a Xapian index directory. In the first case, the Xapian index directory will be obtained from the selected configuration.

If the external index is actually located on a volume mounted from another machine, and references remote files, there may be a need to adjust the result paths so that they match the locally mounted ones (for opening documents). This can be done by using the path translation facility.

As building the set of all indexes can be a little tedious when done through the user interface, you can use the RECOLL_EXTRA_DBS environment variable to provide an initial set. This might typically be set up by a system administrator so that every user does not have to do it. The variable should define a colon-separated list of index directories, e.g.:

export RECOLL_EXTRA_DBS=/some/place/xapiandb:/some/other/db

On Windows, use semi-colons (;) as separators instead of colons.

Another environment variable, RECOLL_ACTIVE_EXTRA_DBS allows adding to the active list of indexes. This variable was suggested and implemented by a Recoll user. It is mostly useful if you use scripts to mount external volumes with Recoll indexes. By using RECOLL_EXTRA_DBS and RECOLL_ACTIVE_EXTRA_DBS, you can add and activate the index for the mounted volume when starting recoll. Unreachable indexes will automatically be deactivated when starting up.

3.2.12. Document history

Documents that you actually view (with the internal preview or an external tool) are entered into the document history, which is remembered.

You can display the history list by using the Tools/Doc History menu entry.

You can erase the document history by using the Erase document history entry in the File menu.

3.2.13. Sorting search results and collapsing duplicates

The documents in a result list are normally sorted in order of relevance. It is possible to specify a different sort order, either by using the vertical arrows in the GUI toolbox to sort by date, or switching to the result table display and clicking on any header. The sort order chosen inside the result table remains active if you switch back to the result list, until you click one of the vertical arrows, until both are unchecked (you are back to sort by relevance).

Sort parameters are remembered between program invocations, but result sorting is normally always inactive when the program starts. It is possible to keep the sorting activation state between program invocations by checking the Remember sort activation state option in the preferences.

It is also possible to hide duplicate entries inside the result list (documents with the exact same contents as the displayed one). The test of identity is based on an MD5 hash of the document container, not only of the text contents (so that e.g., a text document with an image added will not be a duplicate of the text only). Duplicates hiding is controlled by an entry in the GUI configuration dialog, and is off by default.

When a result document does have undisplayed duplicates, a Dups link will be shown with the result list entry. Clicking the link will display the paths (URLs + ipaths) for the duplicate entries.

3.2.14. Keyboard shortcuts

A number of common actions within the graphical interface can be triggered through keyboard shortcuts. As of Recoll 1.29, many of the shortcut values can be customised from a screen in the GUI preferences. Most shortcuts are specific to a given context (e.g. within a preview window, within the result table).

Most shortcuts can be changed to a preferred value by using the GUI shortcut editor: PreferencesGUI configurationShortcuts. In order to change a shortcut, just click the corresponding cell in the Shortcut column, and type the desired sequence.

Table 3.1. Keyboard shortcuts

Description Default value
Context: almost everywhere
Program exit Ctrl+Q
Context: advanced search
Load the next entry from the search history Up
Load the previous entry from the search history Down
Context: main window
Clear search. This will move the keyboard cursor to the simple search entry and erase the current text Ctrl+S
Move the keyboard cursor to the search entry area without erasing the current text Ctrl+L
Move the keyboard cursor to the search entry area without erasing the current text Ctrl+Shift+S
Toggle displaying the current results as a table or as a list Ctrl+T
Context: main window, when showing the results as a table
Move the keyboard cursor to currently the selected row in the table, or to the first one if none is selected Ctrl+R
Jump to row 0-9 or a-z in the table Ctrl+[0-9] or Ctrl+Shift+[a-z]
Cancel the current selection Esc
Context: preview window
Close the preview window Esc
Close the current tab Ctrl+W
Open a print dialog for the current tab contents Ctrl+P
Load the next result from the list to the current tab Shift+Down
Load the previous result from the list to the current tab Shift+Up
Context: result table
Copy the text contained in the selected document to the clipboard Ctrl+G
Copy the text contained in the selected document to the clipboard, then exit recoll Ctrl+Alt+Shift+G
Open the current document Ctrl+O
Open the current document and exit Recoll Ctrl+Alst+Shift+O
Show a full preview for the current document Ctrl+D
Toggle showing the column names Ctrl+H
Show a snippets (keyword in context) list for the current document Ctrl+E
Toggle showing the row letters/numbers Ctrl+V
Context: snippets window
Close the snippets window Esc
Find in the snippets list (method #1) Ctrl+F
Find in the snippets list (method #2) /
Find the next instance of the search term F3
Find the previous instance of the search term Shift+F3

3.2.15. Search tips

Terms and search expansion

Term completion. While typing into the simple search entry, a popup menu will appear and show completions for the current string. Values preceded by a clock icon come from the history, those preceded by a magnifier icon come from the index terms. This can be disabled in the preferences.

Picking up new terms from result or preview text. Double-clicking on a word in the result list or in a preview window will copy it to the simple search entry field.

Wildcards. Wildcards can be used inside search terms in all forms of searches. More about wildcards.

Automatic suffixes. Words like odt or ods can be automatically turned into query language ext:xxx clauses. This can be enabled in the Search preferences panel in the GUI.

Disabling stem expansion. Entering a capitalized word in any search field will prevent stem expansion (no search for gardening if you enter Garden instead of garden). This is the only case where character case should make a difference for a Recoll search. You can also disable stem expansion or change the stemming language in the preferences.

Finding related documents. Selecting the Find similar documents entry in the result list paragraph right-click menu will select a set of "interesting" terms from the current result, and insert them into the simple search entry field. You can then possibly edit the list and start a search to find documents which may be apparented to the current result.

File names. File names are added as terms during indexing, and you can specify them as ordinary terms in normal search fields (Recoll used to index all directories in the file path as terms. This has been abandoned as it did not seem really useful). Alternatively, you can use the specific file name search which will only look for file names, and may be faster than the generic search especially when using wildcards.

Working with phrases and proximity

Phrases searches. A phrase can be looked for by enclosing a number of terms in double quotes. Example: "user manual" will look only for occurrences of user immediately followed by manual. You can use the "Phrase" field of the advanced search dialog to the same effect. Phrases can be entered along simple terms in all simple or advanced search entry fields, except "Phrase".

Proximity searches. A proximity search differs from a phrase search in that it does not impose an order on the terms. Proximity searches can be entered by specifying the "Proximity" type in the advanced search, or by postfixing a phrase search with a 'p'. Example: "user manual"p would also match "manual user". Also see the modifier section from the query language documentation.

AutoPhrases. This option can be set in the preferences dialog. If it is set, a phrase will be automatically built and added to simple searches when looking for Any terms. This will not change radically the results, but will give a relevance boost to the results where the search terms appear as a phrase. E.g.: searching for virtual reality will still find all documents where either virtual or reality or both appear, but those which contain virtual reality should appear sooner in the list.

Phrase searches can slow down a query if most of the terms in the phrase are common. If the autophrase option is on, very common terms will be removed from the automatically constructed phrase. The removal threshold can be adjusted from the search preferences.

Phrases and abbreviations. Dotted abbreviations like I.B.M. are also automatically indexed as a word without the dots: IBM. Searching for the word inside a phrase (e.g.: "the IBM company") will only match the dotted abrreviation if you increase the phrase slack (using the advanced search panel control, or the o query language modifier). Literal occurrences of the word will be matched normally.

Others

Using fields. You can use the query language and field specifications to only search certain parts of documents. This can be especially helpful with email, for example only searching emails from a specific originator: search tips from:helpfulgui

Adjusting the result table columns. When displaying results in table mode, you can use a right click on the table headers to activate a pop-up menu which will let you adjust what columns are displayed. You can drag the column headers to adjust their order. You can click them to sort by the field displayed in the column. You can also save the result list in CSV format.

Changing the GUI geometry. It is possible to configure the GUI in wide form factor by dragging the toolbars to one of the sides (their location is remembered between sessions), and moving the category filters to a menu (can be set in the PreferencesGUI configurationUser interface panel).

Query explanation. You can get an exact description of what the query looked for, including stem expansion, and Boolean operators used, by clicking on the result list header.

Advanced search history. You can display any of the last 100 complex searches performed by using the up and down arrow keys while the advanced search panel is active.

Forced opening of a preview window. You can use Shift+Click on a result list Preview link to force the creation of a preview window instead of a new tab in the existing one.

3.2.16. Saving and restoring queries

Both simple and advanced query dialogs save recent history, but the amount is limited: old queries will eventually be forgotten. Also, important queries may be difficult to find among others. This is why both types of queries can also be explicitly saved to files, from the GUI menus: FileSave last query / Load last query

The default location for saved queries is a subdirectory of the current configuration directory, but saved queries are ordinary files and can be written or moved anywhere.

Some of the saved query parameters are part of the preferences (e.g. autophrase or the active external indexes), and may differ when the query is loaded from the time it was saved. In this case, Recoll will warn of the differences, but will not change the user preferences.

3.2.17. Customising the search interface

You can customise some aspects of the search interface by using the GUI configuration entry in the Preferences menu.

There are several tabs in the dialog, dealing with the interface itself, the parameters used for searching and returning results, and what indexes are searched.

Most GUI settings are global and do not depend on the index in use. As of Recoll 1.42, it is possible to specify that some settings will depend on the index. At the moment, only the result table configuration can be saved in such a way.

Choosing the viewer applications

By default Recoll lets the desktop choose what application should be used to open a given document, with exceptions.

The details of this behaviour can be customised with the PreferencesGUI configurationUser interfaceChoose editor applications dialog or by editing the mimeview configuration file.

When Use desktop preferences, at the top of the dialog, is checked, the desktop default is generally used, but there is a small default list of exceptions, for MIME types where the Recoll choice should override the desktop one. These are applications which are well integrated with Recoll, for example, on Linux, evince for viewing PDF and Postscript files because of its support for opening the document at a specific page and passing a search string as an argument. You can add or remove document types to the exceptions by using the dialog.

If you prefer to completely customise the choice of applications, you can uncheck Use desktop preferences, in which case the Recoll predefined applications will be used, and can be changed for each document type. This is probably not the most convenient approach in most cases.

In all cases, the applications choice dialog accepts multiple selections of MIME types in the top section, and lets you define how they are processed in the bottom one. In most cases, you will be using %f as a place holder to be replaced by the file name in the application command line.

You may also change the choice of applications by editing the mimeview configuration file if you find this more convenient.

Under Unix-like systems, each result list entry also has a right-click menu with an Open With entry. This lets you choose an application from the list of those which registered with the desktop for the document MIME type, on a case by case basis.

The GUI preferences dialog

Many aspects of the Recoll GUI can be customised from dialogs reached through the PreferencesGUI configuration menu choice.

Not all choices from the different panels will be described below. Many are self-evident or have sufficient tooltip text to provide explanations.

User interface
  • Choose editor application: this opens the dialog which allows you to select the application to be used to open each MIME type, which was described in detail in the previous section.

  • Single application: when checked, starting the Recoll GUI will activate an existing instance instead of creating a new one.

  • Start with simple search mode: this lets you choose the value of the simple search type on program startup. Either a fixed value (e.g. Query Language), or the value in use when the program last exited.

  • Maximum size of search history: limit how many searches are stored in the history. Set to -1 for no limit. The history can be cleared in the File menu.

  • Start with advanced search dialog open : If you use this dialog frequently, checking the entries will get it to open when the GUI starts.

  • Remember sort activation state if set, the GUI will remember the sort tool state between invocations. It normally starts with sorting disabled.

  • Depth of side filter directory tree: decide how many levels should be shown in the directory filter panel.

  • Side filter dates format: allows changing how dates are displayed in the side filter. See the tooltip for details.

  • Document filter choice style: this will let you choose if the document categories are displayed as a list or a set of buttons, or a menu.

  • Disable Qt autocompletion in search entry: this will disable the completion popup. Il will only appear, and display the full history, either if you enter only white space in the search area, or if you click the clock button on the right of the area.

  • Highlight CSS style for query terms: Terms from the user query are highlighted in the result list and the preview window. The highligthing style can be chosen here, for example color: blue or color: red;background: yellow. Mostly any CSS style should work.

  • Display scale: This actually adjust the font sizes everywhere inside the GUI and can be used on High resolution displays if the default characters are too small.

  • Style sheet: The name of a Qt style sheet text file which is applied to the whole GUI on startup. The default value is empty, but there is a skeleton style sheet (recoll.qss) inside the /usr/share/recoll/examples directory. Using a style sheet, you can change most recoll graphical parameters: colors, fonts, etc. See the sample file for a few simple examples.

    You should be aware that parameters (e.g.: the background color) set inside the Recoll GUI style sheet will override global system preferences, with possible strange side effects: for example if you set the foreground to a light color and the background to a dark one in the desktop preferences, but only the background is set inside the Recoll style sheet, and it is light too, then text will appear light-on-light inside the Recoll GUI.

Result list:
  • Result list font: There is quite a lot of information shown in the result list, and you may want to customise the font and/or font size. The rest of the fonts used by Recoll are determined by your generic Qt configuration (try the qtconfig command).

  • Edit result list paragraph format string: allows you to change the presentation of each result list entry. See the result list customisation section.

  • Edit result page HTML header insert: allows you to define text inserted at the end of the result page HTML header. More detail in the result list customisation section.

  • Date format: allows specifying the format used for displaying dates inside the result list. This should be specified as an strftime() string (man strftime).

  • Abstract snippet separator: for synthetic abstracts built from index data, which are usually made of several snippets from different parts of the document, this defines the snippet separator, an ellipsis by default.

Preview
  • Maximum text size highlighted for preview: Disable search term highlighting for texts bigger than the given size to speed up loading. Creating highlights on search terms involves quite a lot of processing, and can be slow.

  • Prefer HTML to plain text for preview: if set, Recoll will display HTML as such inside the preview window. If this causes display problems, you can uncheck it to display the plain text version instead. A common issue is insufficient contrast on a dark mode display, caused by the document style sheet.

  • Activate links in preview: if set, Recoll will turn HTTP links found inside plain text into proper HTML anchors, and clicking a link inside a preview window will start the default browser on the link target.

  • Fields display: max field length before using summary: this is used to limit the size of metadata text displayed on the fields view (reached through the right-click popup). Fields over this size will be truncated, with a clickable option to expand.

  • Plain text to HTML line style: when displaying plain text inside the preview window, Recoll tries to preserve some of the original text line breaks and indentation. It can either use PRE HTML tags, which will well preserve the indentation but will force horizontal scrolling for long lines, or use BR tags to break at the original line breaks, which will let the editor introduce other line breaks according to the window width, but will lose some of the original indentation. The third option is the default and probably the best one in most cases: use PRE tags with line wrapping.

  • Search term line offset: how many lines to display over a search hit. Allows having some context for the found search term.

Search parameters:
  • Hide duplicate results: decides if result list entries are shown for identical documents found in different places.

  • Stemming language: stemming obviously depends on the document's language. This listbox will let you chose among the stemming databases which were built during indexing (this is set in the main configuration file), or later added with recollindex -s (See the recollindex manual). Stemming languages which are dynamically added will be deleted at the next indexing pass unless they are also added in the configuration file.

  • Automatically add phrase to simple searches: a phrase will be automatically built and added to simple searches when looking for Any terms. This will give a relevance boost to the results where the search terms appear as a phrase (consecutive and in order).

  • Autophrase term frequency threshold percentage: very frequent terms should not be included in automatic phrase searches for performance reasons. The parameter defines the cutoff percentage (percentage of the documents where the term appears).

  • Replace abstracts from documents: this decides if we should synthesize and display an abstract in place of an explicit abstract found within the document itself.

  • Dynamically build abstracts: this decides if Recoll tries to build document abstracts (lists of snippets) when displaying the result list. Abstracts are constructed by taking context from the document information, around the search terms.

  • Synthetic abstract size: adjust to taste.

  • Synthetic abstract context words: how many words should be displayed around each term occurrence.

  • Query language magic file name suffixes: a list of words which automatically get turned into ext:xxx file name suffix clauses when starting a query language query (e.g.: doc xls xlsx...). This will save some typing for people who use file types a lot when querying.

External indexes:

This panel will let you browse for additional indexes that you may want to search. External indexes are designated by their database directory (e.g.: /home/someothergui/.recoll/xapiandb, /usr/local/recollglobal/xapiandb).

Once entered, the indexes will appear in the External indexes list, and you can chose which ones you want to use at any moment by checking or unchecking their entries.

Your main database (the one the current configuration indexes to), is always implicitly active. If this is not desirable, you can set up your configuration so that it indexes, for example, an empty directory. An alternative indexer may also need to implement a way of purging the index from stale data.

The result list format

Recoll normally uses a full function HTML processor to display the result list and the snippets window. Depending on the version, this may be based on either Qt WebKit or Qt WebEngine. It is then possible to completely customise the result list with full support for CSS and Javascript.

It is also possible to build Recoll to use a simpler Qt QTextBrowser widget to display the HTML, which may be necessary if the ones above are not ported on the system, or to reduce the application size and dependencies. There are limits to what you can do in this case, but it is still possible to decide what data each result will contain, and how it will be displayed.

The result list presentation can be customised by adjusting two elements:

  • The paragraph format

  • HTML code inside the header section. This is also used for the snippets window.

The paragraph format and the header fragment can be edited from the Result list tab of the GUI configuration.

The header fragment is used both for the result list and the snippets window. The snippets list is a table and has a snippets class attribute. Each paragraph in the result list is a table, with class respar, but this can be changed by editing the paragraph format.

There are a few examples on the page about customising the result list on the Recoll Web site.

The paragraph format

This is an arbitrary HTML string which will be transformed by printf-like % substitutions to show the results.

Note

Any literal % character in the input must be quoted as %%. E.g. <table style="width: 100%;"> should be entered as <table style="width: 100%%;">.

The following substitutions will be performed:

%A

Abstract. If %s is not present, this will be either the document abstract attribute if one is present, or the synthetic snippets abstract. If %s is present, this will be the document abstract or empty.

%D

Date.

%I

Icon image name. This is normally determined from the MIME type. The associations are defined inside the mimeconf configuration file. If a thumbnail for the file is found at the standard Freedesktop location, this will be displayed instead.

%K

Keywords.

%L

Precooked Preview, Edit, and possibly Snippets links.

%M

MIME type.

%N

result Number inside the result page.

%P

Parent folder Url. In the case of an embedded document, this is the parent folder for the top level container file.

%R

Relevance percentage.

%S

Size information.

%s

Synthetic "snippets" abstract (selected text around search terms found in the document.

%T

Title if this is set, else Filename.

%t

Title or empty.

%(filename)

File name.

%U

Url

In addition to the predefined values above, all strings like %(fieldname) will be replaced by the value of the field named fieldname for this document. Only stored fields can be accessed in this way, the value of indexed but not stored fields is not known at this point in the search process (see field configuration). There are currently very few fields stored by default, apart from the values above (only author and filename), so this feature will need some custom local configuration to be useful. An example candidate would be the recipient field which is generated by the message input handlers.

The format of the Preview, Edit, and Snippets links is <a href="P%N">, <a href="E%N"> and <a href="A%N"> where docnum (%N) expands to the document number inside the result page).

A link target defined as "F%N" will open the document corresponding to the %P parent folder expansion, usually creating a file manager window on the folder where the container file resides. E.g.:

<a href="F%N">%P</a>

A link target defined as R%N|scriptname will run the corresponding script on the result file (if the document is embedded, the script will be started on the top-level parent). See the section about defining scripts. Note that scriptname value should be the value of the Name field of the desktop file, and not the desktop file name.

The default value for the paragraph format string is:

"<table class=\"respar\">\n"
"<tr>\n"
"<td><a href='%U'><img src='%I' width='64'></a></td>\n"
"<td>%L &nbsp;<i>%S</i> &nbsp;&nbsp;<b>%T</b><br>\n"
"<span style='white-space:nowrap'><i>%M</i>&nbsp;%D</span>&nbsp;&nbsp;&nbsp; <i>%U</i>&nbsp;%i<br>\n"
"%s %A %K</td>\n"
"</tr></table>\n"

You may, for example, try the following for a more web-like experience:

<u><b><a href="P%N">%T</a></b></u><br>
%A<font color=#008000>%U - %S</font> - %L

Note that the P%N link in the above paragraph makes the title a preview link. Or the clean looking:

<img src="%I" align="left">%L <font color="#900000">%R</font>
&nbsp;&nbsp;<b>%T&</b><br>%S&nbsp;
<font color="#808080"><i>%U</i></font>
<table bgcolor="#e0e0e0">
<tr><td><div>%A</div></td></tr>
</table>%K

These samples, and some others are on the web site, with pictures to show how they look.

It is also possible to define the value of the snippet separator inside the abstract section.

3.2.18. The recoll GUI command line options

The recoll command has a number of useful command line options.

-c configdir specifies a non-default configuration directory.

-L lang can be used to use a different language for the GUI labels than the one which would be chosen according to the system locale. Some translations are quite incomplete and you may prefer to see the English messages, even if your machine is generally setup for, e.g. Spanish. Example:

recoll -L en

-q query specifies a query to be run when the program starts. It takes a single argument, which must be quoted if it contains white space.

-o/-l/-f/-a specify the type of query. The default is to interpret the -q argument as a query language string. You can use these options to interpret the argument as an Any Term, File Name or All Terms query instead.

The -t option will tell the program to behave exactly like the recollq command, printing the results to the standard output (terminal) instead of starting a graphical window.

3.3. Searching with the KDE KIO slave

The Recoll KIO slave allows performing a Recoll search by entering an appropriate URL in a KDE open dialog, or a Dolphin URL. The results are displayed as directory entries.

The instructions for building this module are located in the source tree. See: kde/kio/recoll/00README.txt. Some Linux distributions do package the kio-recoll module, so check before diving into the build process, maybe it's already out there ready for one-click installation.

3.4. Searching on the command line

There are several ways to obtain search results as a text stream, without a graphical interface:

  • By passing option -t to the recoll program, or by calling it as recollq (through a link).

  • By using the actual recollq program.

  • By writing a custom Python program, using the Recoll Python API.

The first two methods work in the same way and accept/need the same arguments (except for the additional -t to recoll). The query to be executed is specified as command line arguments.

recollq is not always built by default. You can use the Makefile in the query directory to build it. This is a very simple program, and if you can program a little c++, you may find it useful to taylor its output format to your needs. Apart from being easily customised, recollq is only really useful on systems where the Qt libraries are not available, else it is redundant with recoll -t.

recollq has a man page. The Usage string follows:

recollq: usage:
 -P: Show the date span for all the documents present in the index.
 [-o|-a|-f] [-q] <query string>
 Runs a recoll query and displays result lines. 
  Default: will interpret the argument(s) as a xesam query string.
  Query elements: 
   * Implicit AND, exclusion, field spec:  t1 -t2 title:t3
   * OR has priority: t1 OR t2 t3 OR t4 means (t1 OR t2) AND (t3 OR t4)
   * Phrase: "t1 t2" (needs additional quoting on cmd line)
 -o Emulate the GUI simple search in ANY TERM mode.
 -a Emulate the GUI simple search in ALL TERMS mode.
 -f Emulate the GUI simple search in filename mode.
 -q is just ignored (compatibility with the recoll GUI command line).
Common options:
 -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR.
 -C : collapse duplicates
 -d also dump file contents.
 -n [first-]<cnt> define the result slice. The default value for [first]
    is 0. Without the option, the default max count is 2000.
    Use n=0 for no limit.
 -b : basic. Just output urls, no mime types or titles.
 -Q : no result lines, just the processed query and result count.
 -m : dump the whole document meta[] array for each result.
 -A : output the document abstracts.
    -p <cnt> : show <cnt> snippets, with page numbers instead of the concatenated abstract.
    -g <cnt> : show <cnt> snippets, with line numbers instead of the concatenated abstract.
 -S fld : sort by field <fld>.
   -D : sort descending.
 -s stemlang : set stemming language to use (must exist in index...).
    Use -s "" to turn off stem expansion.
 -T <synonyms file>: use the parameter (Thesaurus) for word expansion.
 -i <dbdir> : additional index, several can be given.
 -e use url encoding (%xx) for urls.
 -E use exact result count instead of lower bound estimate.
 -F <field name list> : output exactly these fields for each result.
    The field values are encoded in base64, output in one line and 
    separated by one space character. This is the recommended format 
    for use by other programs. Use a normal query with option -m to 
    see the field names. Use -F '' to output all fields, but you probably
    also want option -N in this case.
   -N : with -F, print the (plain text) field names before the field values.
 --extract_to <filepath> : extract the first result to filepath, which must not exist.
      Use a -n option with an offset to select the appropriate result.
      

Sample execution:

recollq 'ilur -nautique mime:text/html'
Recoll query: ((((ilur:(wqf=11) OR ilurs) AND_NOT (nautique:(wqf=11) OR nautiques OR nautiqu OR nautiquement)) FILTER Ttext/html))
4 results
text/html       [file:///Users/dockes/projets/bateaux/ilur/comptes.html]      [comptes.html]  18593   bytes   
text/html       [file:///Users/dockes/projets/nautique/webnautique/articles/ilur1/index.html] [Constructio...
text/html       [file:///Users/dockes/projets/pagepers/index.html]    [psxtcl/writemime/recoll]...
text/html       [file:///Users/dockes/projets/bateaux/ilur/factEtCie/recu-chasse-maree....
      

3.5. The query language

The Recoll query language was based on the now defunct Xesam user search language specification. It allows defining general boolean searches within the main body text or specific fields, and has many additional features, broadly equivalent to those provided by complex search interface in the GUI.

The query language processor is activated in the GUI simple search entry when the search mode selector is set to Query Language. It can also be used from the command line search, the KIO slave, or the WEB UI.

If the results of a query language search puzzle you and you doubt what has been actually searched for, you can use the GUI Show Query link at the top of the result list to check the exact query which was finally executed by Xapian.

3.5.1. General syntax

Here follows a sample request that we are going to explain:

        author:"john doe" Beatles OR Lennon Live OR Unplugged -potatoes
      

This would search for all documents with John Doe appearing as a phrase in the author field (exactly what this is would depend on the document type, e.g.: the From: header, for an email message), and containing either beatles or lennon and either live or unplugged but not potatoes (in any part of the document).

An element is composed of an optional field specification, and a value, separated by a colon (the field separator is the last colon in the element). Examples:

  • Eugenie

  • author:balzac

  • dc:title:grandet

  • dc:title:"eugenie grandet"

The colon, if present, means "contains". Xesam defines other relations, which are mostly unsupported for now (except in special cases, described further down).

All elements in the search entry are normally combined with an implicit AND. It is possible to specify that elements be OR'ed instead, as in Beatles OR Lennon. The OR must be entered literally (capitals), and it has priority over the AND associations: word1 word2 OR word3 means word1 AND (word2 OR word3) not (word1 AND word2) OR word3.

You can use parentheses to group elements (from version 1.21), which will sometimes make things clearer, and may allow expressing combinations which would have been difficult otherwise.

An element preceded by a - specifies a term that should not appear.

By default, words inside double-quotes define a phrase search (the order of words is significant), so that title:"prejudice pride" is not the same as title:prejudice title:pride, and is unlikely to find a result. This can be changed by using modifiers.

Words inside phrases and capitalized words are not stem-expanded. Wildcards may be used anywhere inside a term. Specifying a wildcard on the left of a term can produce a very slow search (or even an incorrect one if the expansion is truncated because of excessive size). Also see More about wildcards.

To save you some typing, Recoll versions 1.20 and later interpret a field value given as a comma-separated list of terms as an AND list and a slash-separated list as an OR list. No white space is allowed. So

author:john,lennon

will search for documents with john and lennon inside the author field (in any order), and

author:john/ringo

would search for john or ringo. This behaviour is only triggered by a field prefix: without it, comma- or slash- separated input will produce a phrase search. However, you can use a text field name to search the main text this way, as an alternate to using an explicit OR, e.g. text:napoleon/bonaparte would generate a search for napoleon or bonaparte in the main text body.

Modifiers can be set on a double-quote value, for example to specify a proximity search (unordered). See the modifier section. No space must separate the final double-quote and the modifiers value, e.g. "two one"po10

Recoll currently manages the following default fields:

  • title, subject or caption are synonyms which specify data to be searched for in the document title or subject.

  • author or from for searching the documents originators.

  • recipient or to for searching the documents recipients.

  • keyword for searching the document-specified keywords (few documents actually have any).

  • filename for the document's file name. You can use the shorter fn alias. This value is not set for all documents: internal documents contained inside a compound one (for example an EPUB section) do not inherit the container file name any more, this was replaced by an explicit field (see next). Sub-documents can still have a filename, if it is implied by the document format, for example the attachment file name for an email attachment.

  • containerfilename, aliased as cfn. This is set for all documents, both top-level and contained sub-documents, and is always the name of the filesystem file which contains the data. The terms from this field can only be matched by an explicit field specification (as opposed to terms from filename which are also indexed as general document content). This avoids getting matches for all the sub-documents when searching for the container file name.

  • ext specifies the file name extension (Ex: ext:html).

  • rclmd5 the MD5 checksum for the document. This is used for displaying the duplicates of a search result (when querying with the option to collapse duplicate results). Incidentally, this could be used to find the duplicates of any given file by computing its MD5 checksum and executing a query with just the rclmd5 value.

You can define aliases for field names, in order to use your preferred denomination or to save typing (e.g. the predefined fn and cfn aliases defined for filename and containerfilename). See the section about the fields file.

The document input handlers have the possibility to create other fields with arbitrary names, and aliases may be defined in the configuration, so that the exact field search possibilities may be different for you if someone took care of the customisation.

3.5.2. Special field-like specifiers

The field syntax also supports a few field-like, but special, criteria, for which the values are interpreted differently. Regular processing does not apply (for example the slash- or comma- separated lists don't work). A list follows.

  • dir for filtering the results on file location. For example, dir:/home/me/somedir will restrict the search to results found anywhere under the /home/me/somedir directory (including subdirectories).

    Tilde expansion will be performed as usual. Wildcards will be expanded, but please have a look at an important limitation of wildcards in path filters.

    You can also use relative paths. For example, dir:share/doc would match either /usr/share/doc or /usr/local/share/doc.

    -dir will find results not in the specified location.

    Several dir clauses can be specified, both positive and negative. For example the following makes sense:

    dir:recoll dir:src -dir:utils -dir:common

    This would select results which have both recoll and src in the path (in any order), and which have not either utils or common.

    You can also use OR conjunctions with dir: clauses.

    On Unix-like systems, a special aspect of dir clauses is that the values in the index are not transcoded to UTF-8, and never lower-cased or unaccented, but stored as binary. This means that you need to enter the values in the exact lower or upper case, and that searches for names with diacritics may sometimes be impossible because of character set conversion issues. Non-ASCII UNIX file paths are an unending source of trouble and are best avoided.

    You need to use double-quotes around the path value if it contains space characters.

    The shortcut syntax to define OR or AND lists within fields with commas or slash characters is not available.

  • size for filtering the results on file size. Example: size<10000. You can use <, > or = as operators. You can specify a range like the following: size>100 size<1000. The usual k/K, m/M, g/G, t/T can be used as (decimal) multipliers. Ex: size>1k to search for files bigger than 1000 bytes.

  • date for searching or filtering on dates. The syntax for the argument is based on the ISO8601 standard for dates and time intervals. Only dates are supported, no times. The general syntax is 2 elements separated by a / character. Each element can be a date or a period of time. Periods are specified as PnYnMnD. The n numbers are the respective numbers of years, months or days, any of which may be missing. Dates are specified as YYYY-MM-DD. The days and months parts may be missing. If the / is present but an element is missing, the missing element is interpreted as the lowest or highest date in the index. Examples:

    • 2001-03-01/2002-05-01 the basic syntax for an interval of dates.

    • 2001-03-01/P1Y2M the same specified with a period.

    • 2001/ from the beginning of 2001 to the latest date in the index.

    • 2001 the whole year of 2001

    • P2D/ means 2 days ago up to now if there are no documents with dates in the future.

    • /2003 all documents from 2003 or older.

    Periods can also be specified with small letters (e.g.: p2y).

  • mime or format for specifying the MIME type. These clauses are processed apart from the normal Boolean logic of the search: multiple values will be OR'ed (instead of the normal AND). You can specify types to be excluded, with the usual -, and use wildcards. Example: mime:text/* -mime:text/plain. Specifying an explicit boolean operator before a mime specification is not supported and will produce strange results.

  • type or rclcat for specifying the category (as in text/media/presentation/etc.). The classification of MIME types in categories is defined in the Recoll configuration (mimeconf), and can be modified or extended. The default category names are those which permit filtering results in the main GUI screen. Categories are OR'ed like MIME types above, and can be negated with -.

  • issub for specifying that only standalone (issub:0) or only embedded (issub:1) documents should be returned as results.

Note

mime, rclcat, size, issub and date criteria always affect the whole query (they are applied as a final filter), even if set with other terms inside a parenthesis.

Note

mime (or the equivalent rclcat) is the only field with an OR default. You do need to use OR with ext terms for example.

3.5.3. Range clauses

Recoll 1.24 and later support range clauses on fields which have been configured to support it. No default field uses them currently, so this paragraph is only interesting if you modified the fields configuration and possibly use a custom input handler.

A range clause looks like one of the following:

myfield:small..big
myfield:small..
myfield:..big
        

The nature of the clause is indicated by the two dots .., and the effect is to filter the results for which the myfield value is in the possibly open-ended interval.

See the section about the fields configuration file for the details of configuring a field for range searches (list them in the [values] section).

3.5.4. Modifiers

Some characters are recognized as search modifiers when found immediately after the closing double quote of a phrase, as in "some term"modifierchars. The actual "phrase" can be a single term of course. Supported modifiers:

  • l can be used to turn off stemming (mostly makes sense with p because stemming is off by default for phrases, but see also x further down).

  • o can be used to specify a "slack" for both phrase and proximity searches: the number of additional terms that may be found between the specified ones. If o is followed by an integer number, this is the slack, else the default is 10. The default slack (with no o) is 0 for phrase searches and 10 for proximity searches.

  • p can be used to turn an ordered phrase search into an unordered proximity one. Example: "order any in"p. You can find a little more detail about phrase and proximity searches here.

  • s (1.22) can be used to turn off synonym expansion, if a synonyms file is in place.

  • x (1.33.2) will enable the expansion of terms inside a phrase search (the default is for phrases to be searched verbatim). Also see the stemexpandphrases in the configuration section, for changing the default behaviour.

  • A weight can be specified for a query element by specifying a decimal value at the start of the modifiers. Example: "Important"2.5.

The following only make sense on indexes which are capable of case and diacritics sensitivity (not the default):

  • C will turn on case sensitivity.

  • D will turn on diacritics sensitivity (if the index supports it).

  • e (explicit) will turn on diacritics sensitivity and case sensitivity, and prevent stem expansion.

3.6. Wildcards and anchored searches

Some special characters are interpreted by Recoll in search strings to expand or specialize the search. Wildcards expand a root term in controlled ways. Anchor characters can restrict a search to succeed only if the match is found at or near the beginning of the document or one of its fields.

3.6.1. Wildcards

All words entered in Recoll search fields will be processed for wildcard expansion before the request is finally executed.

The wildcard characters are:

  • * which matches 0 or more characters.

  • ? which matches a single character.

  • [] which allow defining sets of characters to be matched (ex: [abc] matches a single character which may be 'a' or 'b' or 'c', [0-9] matches any number.

You should be aware of a few things when using wildcards.

  • Using a wildcard character at the beginning of a word can make for a slow search because Recoll will have to scan the whole index term list to find the matches. However, this is much less a problem for field searches, and queries like