[Dovecot] Writing an FTS plugin

John Morrissey jwm at horde.net
Thu Jan 23 21:30:42 EET 2014


On Sat, Jan 04, 2014 at 03:03:25PM -0500, John Morrissey wrote:
> 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
> seq_range_array_add().
> 
> 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
> plugin:
> 
>   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?

I haven't made much progress on this, and I'd love if someone knowledgeable
about this part of the code base could point me in the right direction.

I'm obv. more than happy to submit the final plugin, but I need a hand
getting past this.

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


More information about the dovecot mailing list