Introduction

Recoll versions after 1.11 define a Python programming interface, both for searching and indexing. The indexing portion has seen little use, but the searching one is used in the Recoll Ubuntu Unity Lens and Recoll Web UI.

The API is inspired by the Python database API specification. There were two major changes in recent Recoll versions:

  • The basis for the Recoll API changed from Python database API version 1.0 (Recoll versions up to 1.18.1), to version 2.0 (Recoll 1.18.2 and later).
  • The recoll module became a package (with an internal recoll module) as of Recoll version 1.19, in order to add more functions. For existing code, this only changes the way the interface must be imported.

We will mostly describe the new API and package structure here. A paragraph at the end of this section will explain a few differences and ways to write code compatible with both versions.

The Python interface can be found in the source package, under python/recoll.

The python/recoll/ directory contains the usual setup.py. After configuring the main Recoll code, you can use the script to build and install the Python module:

            cd recoll-xxx/python/recoll
            python setup.py build
            python setup.py install
          

The normal Recoll installer installs the Python API along with the main code.

When installing from a repository, and depending on the distribution, the Python API can sometimes be found in a separate package.