unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Do path: searches handle spaces correctly?
@ 2014-09-20 21:44 Keith Amidon
  2014-09-22  9:20 ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Amidon @ 2014-09-20 21:44 UTC (permalink / raw)
  To: notmuch

I'm trying to update an archiving tool that used the old folder: search
terms to use the newer folder: or path: terms.  From playing around with
it, I think that the path: term is what I want to use.  However, I am
getting some behavior I don't understand unless path: searches don't
properly handle spaces or I don't know how to quote them properly.

If I do:

notmuch search --output=files path:'dir/INBOX/**'

I get:

<base>/dir/INBOX/cur/1411244319_3.18990.kea-tablet,U=24,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/cur/1411244319_2.18990.kea-tablet,U=23,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/INBOX/Sent Items/cur/1411244324_2.18990.kea-tablet,U=3,FMD5=e99e6ef6cc1489bb6d8b47a4c49bb989:2,S
<base>/dir/INBOX/cur/1411244319_1.18990.kea-tablet,U=22,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,RS
<base>/dir/INBOX/cur/1411244319_0.18990.kea-tablet,U=21,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/cur/1411244318_3.18990.kea-tablet,U=20,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/cur/1411244318_2.18990.kea-tablet,U=19,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/cur/1411244318_1.18990.kea-tablet,U=18,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
<base>/dir/INBOX/INBOX/Sent Items/cur/1411244324_1.18990.kea-tablet,U=2,FMD5=e99e6ef6cc1489bb6d8b47a4c49bb989:2,S
<base>/dir/INBOX/cur/1411244318_0.18990.kea-tablet,U=17,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S

Notice that this contains results for "dir/INBOX/INBOX/Sent Items",
which has a space in it.  If I do:

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?

         Thanks, Keith

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Do path: searches handle spaces correctly?
  2014-09-20 21:44 Do path: searches handle spaces correctly? Keith Amidon
@ 2014-09-22  9:20 ` David Bremner
  2014-09-22 14:42   ` Keith Amidon
  0 siblings, 1 reply; 6+ messages in thread
From: David Bremner @ 2014-09-22  9:20 UTC (permalink / raw)
  To: Keith Amidon, notmuch

Keith Amidon <keith@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.

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Do path: searches handle spaces correctly?
  2014-09-22  9:20 ` David Bremner
@ 2014-09-22 14:42   ` Keith Amidon
  2014-09-22 15:06     ` Austin Clements
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Amidon @ 2014-09-22 14:42 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

On Mon, 2014-09-22 at 11:20 +0200, David Bremner wrote:
> Keith Amidon <keith@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Do path: searches handle spaces correctly?
  2014-09-22 14:42   ` Keith Amidon
@ 2014-09-22 15:06     ` Austin Clements
  2014-09-23  5:27       ` Keith Amidon
  0 siblings, 1 reply; 6+ messages in thread
From: Austin Clements @ 2014-09-22 15:06 UTC (permalink / raw)
  To: Keith Amidon; +Cc: notmuch

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@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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Do path: searches handle spaces correctly?
  2014-09-22 15:06     ` Austin Clements
@ 2014-09-23  5:27       ` Keith Amidon
  2014-09-23  6:18         ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Amidon @ 2014-09-23  5:27 UTC (permalink / raw)
  To: Austin Clements; +Cc: notmuch

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Do path: searches handle spaces correctly?
  2014-09-23  5:27       ` Keith Amidon
@ 2014-09-23  6:18         ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2014-09-23  6:18 UTC (permalink / raw)
  To: Keith Amidon, Austin Clements; +Cc: notmuch

Keith Amidon <camalot@picnicpark.org> writes:

>
> 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.

Yes, it makes sense to add such a section.

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-23  6:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-20 21:44 Do path: searches handle spaces correctly? Keith Amidon
2014-09-22  9:20 ` David Bremner
2014-09-22 14:42   ` Keith Amidon
2014-09-22 15:06     ` Austin Clements
2014-09-23  5:27       ` Keith Amidon
2014-09-23  6:18         ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).