On Sat, 25 Jan 2014, Jani Nikula <jani@nikula.org> wrote: > Perhaps we need to have two prefixes, one of which is the literal > filesystem folder and another which hides the implementation details, > like I mentioned in my mail to Peter [1]. But consider this: my proposed > implementation does cover *all* use cases. Here's a thought. With boolean prefix folder:, we can devise a scheme where the folder: query defines what is to be matched. For example: folder:foo match files in foo, foo/new, and foo/cur. folder:foo/ match all files in all subdirectories under foo (this would handle Tomi's use case), including foo/new and foo/cur. folder:foo/. match in foo only, and specifically not in foo/cur or foo/new. folder:foo/new match in foo/new, and specifically not in foo/cur (this allows distinguishing between messages in cur and new). folder:/ match everything. folder:/. match in top level maildir only. folder:"" match in top level maildir, including cur/new. This requires indexing all the path components with suitable suffixes. For example, a file "foo/new/baz" would get terms "/", "foo", "foo/", "foo/new", and "foo/new/.". A file foo/bar would get terms "/", "foo", "foo/", and "foo/.". It's obviously a concern this increases the database size; not sure how it would compare with the current stemmed probabilistic prefix. Opinions on this? This would really cover all use cases, and address Austin's interface and backward compatibility concerns. BR, Jani.