[Dovecot] using OR in doveadm search query

Joseph Tam jtam.home at gmail.com
Wed Jan 8 01:57:12 EET 2014


> > This works for me (at least with tcsh):
> >
> > $ doveadm search mailbox "shared/* OR (SUBJECT a) (SUBJECT b)"
> doveadm does not complain anymore but it does not find anything. I guess
> because now the query has become a mailbox name that does not exist. ( I
> am using dovecot 2.2.9)

Each search token ought to be a command line argument to doveadm, so if
you're looking for all message with the string "a" or "b" in the subject
in mailboxes shared/*, then this should be the correct syntax, with
all arguments sufficiently escaped from shell interpretation:

 	doveadm search mailbox shared/\* \( SUBJECT a OR SUBJECT b \)

(Delete "OR"  if both strings must be in the subject: expressions are
implicitly AND'd if not OR'd.  In fact, you can also remove the
parenthesis since precedence doesn't matter anymore.)

You can check the search query by fetching some values using the same
query:

 	doveadm fetch 'mailbox hdr' mailbox shared/\* \( SUBJECT a OR SUBJECT b \)

Joseph Tam <jtam.home at gmail.com>


More information about the dovecot mailing list