Writing An Indexer Module

Carlos Garnacho

Creating a module definition file
Creating an extractor module binary

Tracker's indexer has a modular design, so applications can specify where to locate the data to extract metadata from, plus how it should be extracted. To achieve this, tracker-indexer needs two files, one to define module behavior (.module files) plus a .so file that will be called on each of the files the module is interested in.

Creating a module definition file

.module files are a key file with the following format:

[General]
Description=My extractor
Enabled=true

[Monitors]
Directories=
RecurseDirectories=$HOME/Documents;$HOME/Music

[Ignored]
Directories=
Files=

[Index]
Service=EvolutionEmails
MimeTypes=
Files=
      

This file will be installed in $prefix/share/tracker/modules/ and it must share the same name with the corresponding .so file, prefixed with "libtracker-module-" (that is, for my-extractor.module, there must be a libtracker-module-my-extractor.so)

Table 1. Module file description

General
Description A short description for the module
Enabled Whether the module is enabled or not. This is useful at a sysadmin level.
Monitors
Directories Semicolon separated list of directories that the module will handle, the indexer will not recurse into their contents.
RecurseDirectories Semicolon separated list of directories that the module will handle, the indexer will recurse inside these directories' contents.
Ignored
Directories Directories that the indexer will skip.
Files Files that the indexer will skip.