[Dovecot] doveadm fetch vs search+fetch
What's the pactical difference between using "doveadm fetch" rather than using "doveadm search" in conjunction with "doveadm fetch", as the man pages suggest?
It seems "doveadm fetch" functionally supercedes "doveadm search" making the latter obsolete. It can even be closely simulated with "doveadm -f tab fetch ... 'mailbox-guid uid' search-query ...".
Joseph Tam jtam.home@gmail.com
On Wed, 2011-12-07 at 18:00 -0800, Joseph Tam wrote:
What's the pactical difference between using "doveadm fetch" rather than using "doveadm search" in conjunction with "doveadm fetch", as the man pages suggest?
It seems "doveadm fetch" functionally supercedes "doveadm search" making the latter obsolete. It can even be closely simulated with "doveadm -f tab fetch ... 'mailbox-guid uid' search-query ...".
If you want to fetch message headers/bodies separately for multiple messages, then doveadm search is useful. With "doveadm fetch" you can't really know where one message ends and another one begins (although the ^L character between messages is a good indicator, it's not 100% reliable). And in any case it's more difficult to use for separating messages in a shell script.
On Thu, 8 Dec 2011, Timo Sirainen wrote:
It seems "doveadm fetch" functionally supercedes "doveadm search" making the latter obsolete. It can even be closely simulated with "doveadm -f tab fetch ... 'mailbox-guid uid' search-query ...".
If you want to fetch message headers/bodies separately for multiple messages, then doveadm search is useful. With "doveadm fetch" you can't really know where one message ends and another one begins (although the ^L character between messages is a good indicator, it's not 100% reliable). And in any case it's more difficult to use for separating messages in a shell script.
You could use, as I suggested,
doveadm -f tab fetch -u bob 'mailbox-guid uid' ... | \
while read guid uid; do
...
done
which pretty much does the same thing (but you have to dump the first line, ugh!). It doesn't matter all that much except some extra man page reading, but it will save you the bother of having to maintain a separate binary, man page, etc. for what is essentially a duplicate.
Joseph Tam jtam.home@gmail.com
On Wed, 2011-12-07 at 19:56 -0800, Joseph Tam wrote:
If you want to fetch message headers/bodies separately for multiple messages, then doveadm search is useful. With "doveadm fetch" you can't really know where one message ends and another one begins (although the ^L character between messages is a good indicator, it's not 100% reliable). And in any case it's more difficult to use for separating messages in a shell script.
You could use, as I suggested,
doveadm -f tab fetch -u bob 'mailbox-guid uid' ... | \
Oh, you meant this.
while read guid uid; do ... done
which pretty much does the same thing (but you have to dump the first line, ugh!). It doesn't matter all that much except some extra man page reading, but it will save you the bother of having to maintain a separate binary, man page, etc. for what is essentially a duplicate.
Yeah, but it's more effort to remove it than to keep it as it is :) Also a "search" is somewhat simpler and prettier to use.
participants (2)
-
Joseph Tam
-
Timo Sirainen