unexpected behaviour of search queries with mixed AND and OR

Juergen Raschke j.raschke at mittwald.de
Wed Dec 14 10:18:57 UTC 2016


Hello,


I found out an unexpected behaviour of search queries with mixed
"AND" and "OR".


With search query "\( condA OR condB condC \)" I get an error:
Fatal: Use parenthesis when mixing ANDs and ORs

if I switch left and right OR-part and use the query
"\( condB condC OR condA \)"

I get a result, but it is not the expected result of the query
"\( \( condB condC \) OR condA \)"

I get the result of the query
"\( condB OR condC OR condA \)"
which is more then suprising.


The query "\( condB condC OR condA \)" should either throw an
error like "\( condA OR condB condC \)" or deliever the result
of "\( \( condB condC \) OR condA \)"




Example:

doveadm -f flow  fetch -u USER  guid  \( savedbefore 21d OR seen savedbefore 5d \) | wc -l
Fatal: Use parenthesis when mixing ANDs and ORs
0

doveadm -f flow  fetch -u USER  guid  \( seen savedbefore 5d OR savedbefore 21d \) | wc -l
63690

doveadm -f flow  fetch -u USER  guid  \( seen OR savedbefore 5d OR savedbefore 21d \) | wc -l
63690

doveadm -f flow  fetch -u USER  guid  \( \( seen savedbefore 5d \) OR savedbefore 21d \) |wc -l
63247

doveadm -f flow  fetch -u USER  guid  \( savedbefore 21d OR \( seen savedbefore 5d \) \) |wc -l
63247



doveconf -n
# 2.2.24 (a82c823): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.9 (357ac0a0e68b+)
# OS: Linux 3.16.0-0.bpo.4-amd64 x86_64 Debian 7.9





Mit freundlichen Gruessen,

Juergen Raschke

-- 
Mittwald CM Service GmbH & Co. KG
Koenigsberger Strasse 6                         Tel: +49-5772-293-100
32339 Espelkamp                                 Fax: +49-5772-293-333
Geschaeftsfuehrer: Robert Meyer,                HRA  6640, AG Bad Oeynhausen
Komplementaerin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen


More information about the dovecot mailing list