Query operators

Yuri D'Elia wavexx at thregr.org
Mon Aug 29 05:38:03 PDT 2016


On Mon, Aug 29 2016, Charlie Allom <charlie at evilforbeginners.com> wrote:
> You can debug what the real query is by adding NOTMUCH_DEBUG_QUERY=1 to
> your search:
>
>   12:29 YELP-CHARLIE~[local at 2.7.12] % NOTMUCH_DEBUG_QUERY=1 notmuch search 'term1 (tag:term2 tag:term3)'
>   Query string is:
>   term1 (tag:term2 tag:term3)
>   Exclude query is:
>   Xapian::Query((Kdeleted OR Kspam OR Kmuted OR Kkilled OR Kjunk))
>   Final query is:
>   Xapian::Query(((Tmail AND Zterm1:(pos=1) AND 0 * (Kterm2 OR Kterm3)) AND_NOT (Kdeleted OR Kspam OR Kmuted OR Kkilled OR Kjunk)))
>   12:29 YELP-CHARLIE~[local at 2.7.12] %

That was helpful, but confirms that tag terms are combined with OR:

Query string is:
tag:a -(b c)
Final query is:
=> (0 * Ka AND_NOT (Zb:(pos=1) AND Zc:(pos=2)))

(removed the exclusion for brevity)

Query string is:
tag:a -(tag:b tag:c)
Final query is:
=> (0 * Ka AND_NOT 0 * (Kb OR Kc))

is this because they're both prefixed with tag?
Indeed 'tag:a is:b' combines them with AND.

'tag:a is:b tag:c' is actually (tag:a OR tag:c) AND tag:b.

Why this should be helpful?
It's totally unexpected for me.


More information about the notmuch mailing list