Unix-like systems and MacOS systems: importing external tags

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.

Note

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

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.

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.