Re: Apparently, terms with a common prefix are *not* connected by implicit "OR"
On Tue, Aug 20 2019, David Bremner wrote: > This will make > > to:a to:b > > and > > from:a from:b > > expand as > > to:a AND to:b > > and > > from:a AND from:b I can't say if the proposed parser prefix change is correct, but I support this behavior. jamie. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: Apparently, terms with a common prefix are *not* connected by implicit "OR"
Jorge P. de Morais Neto writes: > [ I had replied to David Bremner alone so I didn't have to worry about > private information leakage. But now I decided to clean the private > information and reply to the list too. ] > > Em 2019-08-11T20:08:58-0300, David Bremner escreveu: >> Thanks for the report. As a test, can you try with >> >> $ notmuch count '(to:pontodosconcursos.com.br >> to:"jorge+cp+concu...@disroot.org")' >> >> I suspect that will work around the problem, which I believe is related >> to the way that notmuch uses the xapian parser (in order to provide >> regexp matching for some prefixes). In particular, if I try that with >> NOTMUCH_DEBUG_QUERY=yes in the environment I can see the implicit OR. Thanks for the detailed report. There are (at least) two different things going on (in addition to the strange expansion that I focussed on before, but seems not to be the most important issue). One is that the combining with implicit-OR was only intended to work for "boolean prefixes" like tag:. So this is a documentation bug. A second thing is due to some implimentation details in notmuch, from: was being treated (for purposes of combining) as a filter. I think it's clear we want from: and to: to behave similarly, so I propose the following patch diff --git a/lib/database.cc b/lib/database.cc index 24b7ec43..4db1b465 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -400,7 +400,7 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch) /* we treat all field-processor fields as boolean in order to get the raw input */ if (prefix->prefix) notmuch->query_parser->add_prefix ("", prefix->prefix); - notmuch->query_parser->add_boolean_prefix (prefix->name, fp); + notmuch->query_parser->add_boolean_prefix (prefix->name, fp, !(prefix->flags & NOTMUCH_FIELD_PROBABILISTIC)); } else { _setup_query_field_default (prefix, notmuch); } This will make to:a to:b and from:a from:b expand as to:a AND to:b and from:a AND from:b I don't think it's possible to have to:a to:b expand to to:a OR to:b without also having a b expand to a OR b which I think most people would find surprising. At the moment I'm not sure I see the benefit of having tag: combine with implicit OR (other than being slightly easier to document). ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: Apparently, terms with a common prefix are *not* connected by implicit "OR"
[ I had replied to David Bremner alone so I didn't have to worry about private information leakage. But now I decided to clean the private information and reply to the list too. ] Em 2019-08-11T20:08:58-0300, David Bremner escreveu: > Thanks for the report. As a test, can you try with > > $ notmuch count '(to:pontodosconcursos.com.br > to:"jorge+cp+concu...@disroot.org")' > > I suspect that will work around the problem, which I believe is related > to the way that notmuch uses the xapian parser (in order to provide > regexp matching for some prefixes). In particular, if I try that with > NOTMUCH_DEBUG_QUERY=yes in the environment I can see the implicit OR. > > d Thank you for the instructions, but they did not work. Below are several results from ~notmuch count~. --8<---cut here---start->8--- $ notmuch count '(to:pontodosconcursos.com.br OR to:jorge+cp+concu...@disroot.org)' 70 $ notmuch count '(to:pontodosconcursos.com.br)' 0 $ notmuch count 'to:pontodosconcursos.com.br' 0 $ notmuch count 'to:jorge+cp+concu...@disroot.org' 70 $ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br OR to:jorge+cp+concu...@disroot.org)' Query string is: (to:pontodosconcursos.com.br OR to:jorge+cp+concu...@disroot.org) Exclude query is: Query(((Kdeleted OR Kspam) OR Ktrash)) Final query is: Query(((Tmail AND ((XTOpontodosconcursos@1 PHRASE 3 XTOcom@2 PHRASE 3 XTObr@3) OR (ZXTOjorg@4 AND (Zcp@5 OR ZGcp@5 OR ZKcp@5 OR ZKcp@5 OR ZQcp@5 OR ZQcp@5 OR ZPcp@5 OR ZXPROPERTYcp@5 OR ZXFOLDER:cp@5 OR ZXFROMcp@5 OR ZXTOcp@5 OR ZXATTACHMENTcp@5 OR ZXMIMETYPEcp@5 OR ZXSUBJECTcp@5) AND ((concurso@6 PHRASE 3 disroot@7 PHRASE 3 org@8) OR (Gconcurso@6 PHRASE 3 Gdisroot@7 PHRASE 3 Gorg@8) OR (Kconcurso@6 PHRASE 3 Kdisroot@7 PHRASE 3 Korg@8) OR (Kconcurso@6 PHRASE 3 Kdisroot@7 PHRASE 3 Korg@8) OR (Qconcurso@6 PHRASE 3 Qdisroot@7 PHRASE 3 Qorg@8) OR (Qconcurso@6 PHRASE 3 Qdisroot@7 PHRASE 3 Qorg@8) OR (Pconcurso@6 PHRASE 3 Pdisroot@7 PHRASE 3 Porg@8) OR (XPROPERTYconcurso@6 PHRASE 3 XPROPERTYdisroot@7 PHRASE 3 XPROPERTYorg@8) OR (XFOLDER:concurso@6 PHRASE 3 XFOLDER:disroot@7 PHRASE 3 XFOLDER:org@8) OR (XFROMconcurso@6 PHRASE 3 XFROMdisroot@7 PHRASE 3 XFROMorg@8) OR (XTOconcurso@6 PHRASE 3 XTOdisroot@7 PHRASE 3 XTOorg@8) OR (XATTACHMENTconcurso@6 PHRASE 3 XATTACHMENTdisroot@7 PHRASE 3 XATTACHMENTorg@8) OR (XMIMETYPEconcurso@6 PHRASE 3 XMIMETYPEdisroot@7 PHRASE 3 XMIMETYPEorg@8) OR (XSUBJECTconcurso@6 PHRASE 3 XSUBJECTdisroot@7 PHRASE 3 XSUBJECTorg@8) AND_NOT ((Kdeleted OR Kspam) OR Ktrash))) 70 $ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br to:jorge+cp+concu...@disroot.org)' Query string is: (to:pontodosconcursos.com.br to:jorge+cp+concu...@disroot.org) Exclude query is: Query(((Kdeleted OR Kspam) OR Ktrash)) Final query is: Query(((Tmail AND ((XTOpontodosconcursos@1 PHRASE 3 XTOcom@2 PHRASE 3 XTObr@3) AND ZXTOjorg@4 AND (Zcp@5 OR ZGcp@5 OR ZKcp@5 OR ZKcp@5 OR ZQcp@5 OR ZQcp@5 OR ZPcp@5 OR ZXPROPERTYcp@5 OR ZXFOLDER:cp@5 OR ZXFROMcp@5 OR ZXTOcp@5 OR ZXATTACHMENTcp@5 OR ZXMIMETYPEcp@5 OR ZXSUBJECTcp@5) AND ((concurso@6 PHRASE 3 disroot@7 PHRASE 3 org@8) OR (Gconcurso@6 PHRASE 3 Gdisroot@7 PHRASE 3 Gorg@8) OR (Kconcurso@6 PHRASE 3 Kdisroot@7 PHRASE 3 Korg@8) OR (Kconcurso@6 PHRASE 3 Kdisroot@7 PHRASE 3 Korg@8) OR (Qconcurso@6 PHRASE 3 Qdisroot@7 PHRASE 3 Qorg@8) OR (Qconcurso@6 PHRASE 3 Qdisroot@7 PHRASE 3 Qorg@8) OR (Pconcurso@6 PHRASE 3 Pdisroot@7 PHRASE 3 Porg@8) OR (XPROPERTYconcurso@6 PHRASE 3 XPROPERTYdisroot@7 PHRASE 3 XPROPERTYorg@8) OR (XFOLDER:concurso@6 PHRASE 3 XFOLDER:disroot@7 PHRASE 3 XFOLDER:org@8) OR (XFROMconcurso@6 PHRASE 3 XFROMdisroot@7 PHRASE 3 XFROMorg@8) OR (XTOconcurso@6 PHRASE 3 XTOdisroot@7 PHRASE 3 XTOorg@8) OR (XATTACHMENTconcurso@6 PHRASE 3 XATTACHMENTdisroot@7 PHRASE 3 XATTACHMENTorg@8) OR (XMIMETYPEconcurso@6 PHRASE 3 XMIMETYPEdisroot@7 PHRASE 3 XMIMETYPEorg@8) OR (XSUBJECTconcurso@6 PHRASE 3 XSUBJECTdisroot@7 PHRASE 3 XSUBJECTorg@8 AND_NOT ((Kdeleted OR Kspam) OR Ktrash))) 0 $ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br to:"jorge+cp+concu...@disroot.org")' Query string is: (to:pontodosconcursos.com.br to:"jorge+cp+concu...@disroot.org") Exclude query is: Query(((Kdeleted OR Kspam) OR Ktrash)) Final query is: Query(((Tmail AND ((XTOpontodosconcursos@1 PHRASE 3 XTOcom@2 PHRASE 3 XTObr@3) AND (XTOjorge@4 PHRASE 5 XTOcp@5 PHRASE 5 XTOconcurso@6 PHRASE 5 XTOdisroot@7 PHRASE 5 XTOorg@8))) AND_NOT ((Kdeleted OR Kspam) OR Ktrash))) 0 $ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br OR to:"jorge+cp+concu...@disroot.org")' Query string is: (to:pontodosconcursos.com.br OR to:"jorge+cp+concu...@disroot.org") Exclude query is: Query(((Kdeleted OR Kspam) OR Ktrash)) Final query is: Query(((Tmail AND ((XTOpontodosconcursos@1 PHRASE 3 XTOcom@2 PHRASE 3 XTObr@3) OR (XTOjorge@4 PHRASE 5 XTOcp@5 PHRASE 5 XTOconcurso@6 PHRASE 5 XTOdisroot@7 PHRASE 5 XTOorg@8))) AND_NO
Re: Apparently, terms with a common prefix are *not* connected by implicit "OR"
jorge+l...@disroot.org (Jorge P. de Morais Neto) writes: > Hi. The NOTMUCH-SEARCH-TERMS man page says: > > Each term in the query will be implicitly connected by a logical AND > if no explicit operator is provided (except that terms with a common > prefix will be implicitly combined with OR). > > However, in practice I get different results: > $ notmuch count '(to:pontodosconcursos.com.br OR > to:jorge+cp+concu...@disroot.org)' > 66 > $ notmuch count '(to:pontodosconcursos.com.br > to:jorge+cp+concu...@disroot.org)' > 0 > Thanks for the report. As a test, can you try with $ notmuch count '(to:pontodosconcursos.com.br to:"jorge+cp+concu...@disroot.org")' I suspect that will work around the problem, which I believe is related to the way that notmuch uses the xapian parser (in order to provide regexp matching for some prefixes). In particular, if I try that with NOTMUCH_DEBUG_QUERY=yes in the environment I can see the implicit OR. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Apparently, terms with a common prefix are *not* connected by implicit "OR"
Hi. The NOTMUCH-SEARCH-TERMS man page says: Each term in the query will be implicitly connected by a logical AND if no explicit operator is provided (except that terms with a common prefix will be implicitly combined with OR). However, in practice I get different results: $ notmuch count '(to:pontodosconcursos.com.br OR to:jorge+cp+concu...@disroot.org)' 66 $ notmuch count '(to:pontodosconcursos.com.br to:jorge+cp+concu...@disroot.org)' 0 I have other examples of this. I currently use notmuch 0.29.1 privately backported to Debian buster according to the Debian Wiki [procedure][], but I already got this problem in earlier notmuch releases, including the official Debian buster package. What gives? [procedure]: https://wiki.debian.org/SimpleBackportCreation My workarund is to always explicit the "OR" operator, as in: (to:concurso OR to:dominandoti OR to:cebraspe OR to:gleyson131 OR to:quadrix.org.br OR to:cathedranet.com.br OR from:cathedranet.com.br OR from:quadrix.org.br OR from:gleyson131 OR from:cebraspe OR from:dominandoti OR from:concurso OR is:lists/itaconcursos) If the OR operator was indeed implicit, the query above would be shorter. Regards -- - I am Brazilian. I hope my English is correct and I welcome feedback - Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z - Free/libre software for Android: https://f-droid.org/ - [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]] ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch