[Dovecot] Writing an FTS plugin

John Morrissey jwm at horde.net
Sat Jan 4 22:03:25 EET 2014

Hi, I'm having some trouble writing an FTS plugin that uses notmuch
(http://notmuchmail.org/) as the backend.

As a proof of concept, I'm adding a hardcoded UID to the search results in
the plugin's lookup handler:

  seq_range_array_add(&result->definite_uids, 1, 42);

but this UID is never returned by IMAP SEARCH commands. I know the plugin is
being used, since I'm also syslogging immediately before the call to

Interestingly, SEARCH commands return correct results (based on the mailbox
content and the search terms specified), but I'm not sure where those
results are coming from. The notmuch plugin is the only configured FTS

  mail_plugins = $mail_plugins fts fts_notmuch
  plugin {
    fts = notmuch

What might I be doing wrong?

Additionally, notmuch returns message filenames, which I'll need to
translate to UIDs. I've seen maildir_uidlist_get_uid(), but I'm not sure
where to get the struct maildir_uidlist arg it needs. notmuch only supports
the Maildir format, so using a maildir_* function seems a reasonably safe
assumption, but is there a better way?

John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__

More information about the dovecot mailing list