Do path: searches handle spaces correctly?

Keith Amidon camalot at picnicpark.org
Mon Sep 22 22:27:29 PDT 2014


On Mon, 2014-09-22 at 15:06 +0000, Austin Clements wrote:
> I assume you're doing this from the command line?  Does the following
> work?
> 
> notmuch search --output=files 'path:"dir/INBOX/INBOX/Sent Items/**"'
> 
> Shell quoting and Xapian quoting interact in often confusing ways.  In
> your original command line, the single quotes suppress shell argument
> splitting, but never make it to notmuch, so notmuch sees two search
> terms "path:dir/INBOX/INBOX/Sent" and "Items/**".  In the command line
> I suggested, the single quotes play the same role, but for the entire
> query.  Because of the quoting, notmuch *does* see the inner double
> quotes, which makes the path a single term (note that Xapian only
> accepts double quotes, not single quotes).  In general, it's good to
> enclose the entire command line query in single quotes so shell
> parsing doesn't get in the way of query parsing.

Bingo.  That was it.  Thanks for clarifying how the quoting interacts. 

What do you think about adding a section to the notmuch-search-terms web
page that talks in more detail about the quoting interactions?  If there
were on obvious section about this in the man page it might have helped
me find the issue myself.  If this seems like a good idea I'll take a
crack at it later this week when I get time to research the Xapian
quoting in a bit more detail.

        --- Keith



More information about the notmuch mailing list