Apparently, terms with a common prefix are *not* connected by implicit "OR"

classic Classic list List threaded Threaded
3 messages Options
Jorge P. de Morais Neto Jorge P. de Morais Neto
Reply | Threaded
Open this post in threaded view
|

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:[hidden email])'
    66
    $ notmuch count '(to:pontodosconcursos.com.br to:[hidden email])'
    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
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: Apparently, terms with a common prefix are *not* connected by implicit "OR"

[hidden email] (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:[hidden email])'
>     66
>     $ notmuch count '(to:pontodosconcursos.com.br to:[hidden email])'
>     0
>

Thanks for the report. As a test, can you try with

     $ notmuch count '(to:pontodosconcursos.com.br to:"[hidden email]")'

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
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jorge P. de Morais Neto Jorge P. de Morais Neto
Reply | Threaded
Open this post in threaded view
|

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:"[hidden email]")'
>
> 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:[hidden email])'
70
$ notmuch count '(to:pontodosconcursos.com.br)'
0
$ notmuch count 'to:pontodosconcursos.com.br'
0
$ notmuch count 'to:[hidden email]'
70
$ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br OR to:[hidden email])'
Query string is:
(to:pontodosconcursos.com.br OR to:[hidden email])
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:[hidden email])'
Query string is:
(to:pontodosconcursos.com.br to:[hidden email])
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:"[hidden email]")'
Query string is:
(to:pontodosconcursos.com.br to:"[hidden email]")
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:"[hidden email]")'
Query string is:
(to:pontodosconcursos.com.br OR to:"[hidden email]")
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_NOT
((Kdeleted OR Kspam) OR Ktrash)))
69
$ NOTMUCH_DEBUG_QUERY=yes notmuch count '(to:pontodosconcursos.com.br to:"[hidden email]")'
Query string is:
(to:pontodosconcursos.com.br to:"[hidden email]")
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" to:"[hidden email]")'
Query string is:
(to:"pontodosconcursos.com.br" to:"[hidden email]")
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" to:"[hidden email]"'
Query string is:
to:"pontodosconcursos.com.br" to:"[hidden email]"
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:[hidden email] XOR to:"[hidden email]"'
Query string is:
to:[hidden email] XOR to:"[hidden email]"
Exclude query is:
Query(((Kdeleted OR Kspam) OR Ktrash))
Final query is:
Query(((Tmail AND ((ZXTOjorg@1 AND (Zcp@2 OR ZGcp@2 OR ZKcp@2 OR ZKcp@2 OR ZQcp@2 OR ZQcp@2 OR ZPcp@2 OR ZXPROPERTYcp@2 OR ZXFOLDER:cp@2 OR ZXFROMcp@2 OR ZXTOcp@2 OR ZXATTACHMENTcp@2 OR
ZXMIMETYPEcp@2 OR ZXSUBJECTcp@2) AND ((concurso@3 PHRASE 3 disroot@4 PHRASE 3 org@5) OR (Gconcurso@3 PHRASE 3 Gdisroot@4 PHRASE 3 Gorg@5) OR (Kconcurso@3 PHRASE 3 Kdisroot@4 PHRASE 3
Korg@5) OR (Kconcurso@3 PHRASE 3 Kdisroot@4 PHRASE 3 Korg@5) OR (Qconcurso@3 PHRASE 3 Qdisroot@4 PHRASE 3 Qorg@5) OR (Qconcurso@3 PHRASE 3 Qdisroot@4 PHRASE 3 Qorg@5) OR (Pconcurso@3
PHRASE 3 Pdisroot@4 PHRASE 3 Porg@5) OR (XPROPERTYconcurso@3 PHRASE 3 XPROPERTYdisroot@4 PHRASE 3 XPROPERTYorg@5) OR (XFOLDER:concurso@3 PHRASE 3 XFOLDER:disroot@4 PHRASE 3 XFOLDER:org@5)
OR (XFROMconcurso@3 PHRASE 3 XFROMdisroot@4 PHRASE 3 XFROMorg@5) OR (XTOconcurso@3 PHRASE 3 XTOdisroot@4 PHRASE 3 XTOorg@5) OR (XATTACHMENTconcurso@3 PHRASE 3 XATTACHMENTdisroot@4 PHRASE 3
XATTACHMENTorg@5) OR (XMIMETYPEconcurso@3 PHRASE 3 XMIMETYPEdisroot@4 PHRASE 3 XMIMETYPEorg@5) OR (XSUBJECTconcurso@3 PHRASE 3 XSUBJECTdisroot@4 PHRASE 3 XSUBJECTorg@5))) XOR (XTOjorge@6
PHRASE 5 XTOcp@7 PHRASE 5 XTOconcurso@8 PHRASE 5 XTOdisroot@9 PHRASE 5 XTOorg@10))) AND_NOT ((Kdeleted OR Kspam) OR Ktrash)))
1
--8<---------------cut here---------------end--------------->8---

Below are the contents of ~/home/jorge/.config/notmuch/config~.

--8<---------------cut here---------------start------------->8---
# .notmuch-config - Configuration file for the notmuch mail system
#
# For more information about notmuch, see https://notmuchmail.org

# Database configuration
#
# The only value supported here is 'path' which should be the top-level
# directory where your mail currently exists and to where mail will be
# delivered in the future. Files should be individual email messages.
# Notmuch will store its database within a sub-directory of the path
# configured here named ".notmuch".
#

[database]
path=/home/jorge/offlineimap/Jorge-Disroot

# User configuration
#
# Here is where you can let notmuch know how you would like to be
# addressed. Valid settings are
#
# name Your full name.
# primary_email Your primary email address.
# other_email A list (separated by ';') of other email addresses
# at which you receive email.
#
# Notmuch will use the various email addresses configured here when
# formatting replies. It will avoid including your own addresses in the
# recipient list of replies, and will set the From address based on the
# address to which the original email was addressed.
#
[user]
name=Jorge P. de Morais Neto
primary_email= < jorge AT_SIGN disroot DOT org>
other_email=<REDACTED;<REDACTED>;<REDACTED>;<REDACTED>;<jorge PLUS-SIGN list AT_SIGN disroot DOT org;<REDACTED>;<REDACTED>;<REDACTED>;<REDACTED>;

# Configuration for "notmuch new"
#
# The following options are supported here:
#
# tags A list (separated by ';') of the tags that will be
# added to all messages incorporated by "notmuch new".
#
# ignore A list (separated by ';') of file and directory names
# that will not be searched for messages by "notmuch new".
#
# NOTE: *Every* file/directory that goes by one of those
# names will be ignored, independent of its depth/location
# in the mail store.
#
[new]
# tags=unread;inbox;new;
# http://afew.readthedocs.io/en/latest/quickstart.html#initial-config
tags=new
ignore=

# Search configuration
#
# The following option is supported here:
#
# exclude_tags
# A ;-separated list of tags that will be excluded from
# search results by default.  Using an excluded tag in a
# query will override that exclusion.
#
[search]
exclude_tags=deleted;spam;trash;

# Maildir compatibility configuration
#
# The following option is supported here:
#
# synchronize_flags      Valid values are true and false.
#
# If true, then the following maildir flags (in message filenames)
# will be synchronized with the corresponding notmuch tags:
#
# Flag Tag
# ---- -------
# D draft
# F flagged
# P passed
# R replied
# S unread (added when 'S' flag is not present)
#
# The "notmuch new" command will notice flag changes in filenames
# and update tags, while the "notmuch tag" and "notmuch restore"
# commands will notice tag changes and update flags in filenames
#
[maildir]
synchronize_flags=true

# Cryptography related configuration
#
# The following *deprecated* option is currently supported:
#
# gpg_path
# binary name or full path to invoke gpg.
# NOTE: In a future build, this option will be ignored.
# Setting $PATH is a better approach.
#
[crypto]
gpg_path=gpg
--8<---------------cut here---------------end--------------->8---

 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
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch