Searching from a folder

Austin Clements amdragon at MIT.EDU
Mon Oct 1 05:16:25 PDT 2012


Quoth Damien Cassou on Oct 01 at 11:42 am:
> On Sat, Sep 29, 2012 at 6:12 PM, Austin Clements <amdragon at mit.edu> wrote:
> > $ notmuch search 'folder:"[Gmail].All Mail"'
> > $ notmuch search 'folder:"[Gmail].Important"'
> 
> thank you very much, it indeed works. I'm still a bit puzzled by the
> fact that, on my other mailbox, I'm getting the following results:
> 
> $ notmuch search 'folder:"[Gmail].Important"' | wc --lines
> 8928
> $ notmuch search folder:[Gmail].Important | wc --lines
> 138
> 
> So, without using quoting, something is indeed happening. Do you know what?

In the latter case, you're finding emails that contain the words
"folder" (or words like folder), "gmail", and "important".

$ NOTMUCH_DEBUG_QUERY=1 notmuch search 'folder:"[Gmail].Important"'
Final query is:
Xapian::Query((Tmail AND (XFOLDERgmail:(pos=1) PHRASE 2 XFOLDERimportant:(pos=2))))

This is slightly inscrutable, but you can see that it applied the
folder prefix ("XFOLDER") to both "gmail" and "important" and required
that the two terms appear in a phrase (that is, next to each other).

$ NOTMUCH_DEBUG_QUERY=1 notmuch search 'folder:[Gmail].Important'
Final query is:
Xapian::Query((Tmail AND Zfolder:(pos=1) AND gmail:(pos=2) AND important:(pos=3)))

Whereas here, it's searching for folder, gmail, and important as
regular and completely independent terms (the Z on folder means it's
stemmed, so it will match folders, foldered, etc.)


More information about the notmuch mailing list