Do path: searches handle spaces correctly?

Austin Clements aclements at csail.mit.edu
Mon Sep 22 08:06:07 PDT 2014


Quoth Keith Amidon on Sep 22 at  7:42 am:
> On Mon, 2014-09-22 at 11:20 +0200, David Bremner wrote:
> > Keith Amidon <keith at awakenetworks.com> writes:
> > >
> > > notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items'
> > >
> > > I don't get any results, but it seems like the two results above should
> > > be shown, right?  Am I doing something wrong here?  If it looks like I'm
> > > doing it correctly, what can I do to help troubleshoot the issue?
> > 
> > Note that path:, unlike folder:, does not add the maildir subdirs. Dunno
> > if that's the only issue you are having, but I guess it's one.
> 
> Darn it!  I made a mistake in my original email.  In the test I was
> doing I actually had:
> 
> notmuch search --output=files path:'dir/INBOX/INBOX/Sent Items/**'
> 
> which I believe should have picked up all the subdirectory paths.  I
> just retested to make sure that it still didn't work, and it doesn't.
> 
> Am I still missing something?   Thanks for the help, Keith

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.


More information about the notmuch mailing list