unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Carl Worth <cworth@cworth.org>
Cc: notmuch@notmuchmail.org
Subject: Folder search semantics (was Re: [RFC PATCH v2 0/8] Custom query parser, date search, folder search, and more)
Date: Thu, 3 Feb 2011 01:14:29 -0500	[thread overview]
Message-ID: <20110203061429.GD28537@mit.edu> (raw)
In-Reply-To: <87sjw6hx2l.fsf@yoom.home.cworth.org>

Quoth Carl Worth on Feb 02 at  2:48 pm:
> Restricting my reply to one tiny bit of your mail:
> 
> You wrote:
> > non-recursive is the only thing that makes sense for Maildir++ folders
> 
> Either I'm not understanding Maildir++ folders, or I don't agree with
> you.
> 
> I might have an email archive that looks like this:
> 
>   Maildir
>     .work
>       .project1
>       .project2
>       .etc...
>     .family
>       .dad
>       .mom
>       .brother
>       .etc...
> 
> With the above setup, what would be unreasonable about wanting to search
> for all work-related messages (across all projects, say) with a string
> like "folder:work" ?
> 
> Now, a person might definitely want to search for messages in the
> ".work" folder directly, (not including the sub-folders), so we should
> provide support for users to get at that behavior as well, (such as a
> proposed "folder:work$" or so).
> 
> To me, both cases are perfectly legitimate, and I don't understand an
> argument that claims that only one makes sense. (Or again, I may be
> misunderstanding something.)

(Somebody with more first-hand Maildir++ experience should jump in here.
I stopped using Maildir++ a long time ago, so I may have no idea what
I'm talking about.)

Both cases are perfectly legitimate.

However, the issue with Maildir++ is that the inbox is stored in the
top-level directory:

  Maildir
    cur
    new
    tmp
    .work
    .work.project1

As a consequence, all folders are subfolders of the inbox.  With
recursive search, a search for your inbox folder returns *all* of your
messages.  I wasn't trying to say that we shouldn't support recursive
search (I'm all for flexibility), but it's a confusing default for
Maildir++ because of this.

Maildir++ has the added twist that the inbox folder has no name.  As a
result, currently notmuch can't search for a Maildir++ inbox folder,
which needs to be addressed somehow.  The least surprising approach
would compatibility with the Maildir++ convention of calling the
top-level folder INBOX, the subfolder INBOX.work, etc.


Maildir++ issues aside, I submit that rooted, non-recursive folder
searches are a more natural default with a more conventional syntactic
extension to non-rooted/recursive searches.  In
id:87aaiy3u65.fsf@yoom.home.cworth.org, you mentioned that you
implemented non-rooted folder search to mimic subject search.  But file
system paths are not natural language like subject lines.  File system
paths are hierarchical and rooted.

Of course, special query operators like ^ and $ can mitigate this, but
these queries *aren't* regexps and, furthermore, people don't usually
apply regexps to file names.  They apply globs.  Glob syntax has the
added benefit of congruity with Xapian wildcard syntax.  This naturally
leads to a rooted, non-recursive syntax by default (like globs), where a
* at the end means recursive and a * at the beginning means non-rooted.
In fact, we could easily generalize this to arbitrary shell globs.


Here's a proposal that, I think, addresses Maildir++ inboxes and
subfolders; rooted, non-rooted, recursive, and non-recursive queries;
and then some.  Plus, it wouldn't require many code changes; you've
already done the hard work.

Switch XFOLDER from a probabilistic prefix with word-splitting to a
boolean prefix without word-splitting.  When indexing, strip off the cur
or new and examine the resulting directory name.  If it's the mail root,
this is a Maildir++ inbox, so add the term XFOLDERINBOX.  If it starts
with a dot, it's a Maildir++ subfolder, so add the term
XFOLDERINBOX<.dirname>.  Otherwise, add the term XFOLDER<dirname>.
Then, using a custom query transform for the "folder:" prefix, enumerate
XFOLDER terms and form a synonym query out of those that fnmatch the
user's folder query.

  reply	other threads:[~2011-02-03  6:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16  8:10 [RFC PATCH v2 0/8] Custom query parser, date search, folder search, and more Austin Clements
2011-01-16  8:10 ` [PATCH 1/8] Implement a custom query parser with a mostly Xapian-compatible grammar Austin Clements
2011-01-21  6:37   ` [PATCH 1.5/8] Query parser testing framework and basic tests Austin Clements
2011-01-16  8:10 ` [PATCH 2/8] Parse NEAR and ADJ operators Austin Clements
2011-01-21  6:39   ` [PATCH 2.5/8] Query parser tests for " Austin Clements
2011-01-16  8:10 ` [PATCH 3/8] Parse wildcard queries Austin Clements
2011-01-21  6:40   ` [PATCH 3.5/8] Query parser tests for " Austin Clements
2011-01-22 16:47     ` Michal Sojka
2011-01-23 22:02       ` Austin Clements
2011-01-24 12:24         ` Michal Sojka
2011-01-16  8:10 ` [PATCH 4/8] Replace Xapian query parser with custom query parser Austin Clements
2011-01-16  8:10 ` [PATCH 5/8] Support "tag:*" as well as "NOT tag:*" queries Austin Clements
2011-01-24 17:15   ` [PATCH 5.5/8] test: Wildcard tag search and untagged search Austin Clements
2011-01-16  8:10 ` [PATCH 6/8] Support maildir folder search Austin Clements
2011-01-24 17:13   ` [PATCH 6/8 v2] " Austin Clements
2011-01-24 17:18   ` [PATCH 6.5/8] test: Add tests for custom query parser-based folder searches Austin Clements
2011-01-16  8:10 ` [PATCH 7/8] Implement value range queries Austin Clements
2011-01-16  8:10 ` [PATCH 8/8] Support before: and after: date search with sane date syntax Austin Clements
2011-01-24 17:20   ` [PATCH 8.5/8] test: Add tests for search by date Austin Clements
2011-01-31  4:33 ` [PATCH 9/8] qparser: Delete (and thus close) the Xapian database Austin Clements
2011-02-02  5:03 ` [RFC PATCH v2 0/8] Custom query parser, date search, folder search, and more Austin Clements
2011-02-02 22:48   ` Carl Worth
2011-02-03  6:14     ` Austin Clements [this message]
2011-02-20 19:52       ` Folder search semantics Rob Browning
2011-02-20 20:00         ` Rob Browning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110203061429.GD28537@mit.edu \
    --to=amdragon@mit.edu \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).