Query operators
Charlie Allom
charlie at evilforbeginners.com
Mon Aug 29 04:31:57 PDT 2016
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] %
On Mon, Aug 29 2016 at 11:29:03 AM, Yuri D'Elia <wavexx at thregr.org> wrote:
> Hi everyone,
>
> I'm a bit baffled by the query syntax. Reading the manual:
>
> ``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).''
>
> I would have assumed that:
>
> term1 (tag:term2 tag:term3)
>
> would be equivalent to:
>
> term1 AND (tag:term2 AND tag:term3)
>
> but if I read carefully (and by looking at the query results), since
> tag: is a common prefix between term2 and term3, it is actually:
>
> term1 AND (tag:term2 OR tag:term3)
>
> am I right? Is this a feature of the xapian query syntax? (can it be
> tweaked to _unconditionally_ AND all terms?)
>
> For me, the idea that two terms can be ORed if the prefix is the same
> can cause queries to return unexpected results.
>
> What about:
>
> term1 xterm2 xterm3 term2
>
> Is this:
>
> term1 AND (xterm2 OR xterm3) AND term2
>
> or is it:
>
> term1 OR xterm2 OR xterm3 OR term2
>
> ?
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
--
More information about the notmuch
mailing list