[PATCH 0/5] lib: make folder: prefix literal

Jani Nikula jani at nikula.org
Wed Jan 29 11:05:30 PST 2014


On Sun, 26 Jan 2014, Carl Worth <cworth at cworth.org> wrote:
> Jani Nikula <jani at nikula.org> writes:
>> Here's a thought. With boolean prefix folder:, we can devise a scheme
>> where the folder: query defines what is to be matched.
>
> I like the idea, but I tried to infer the rules from the examples, and I
> failed. It looks like there are two new symbols, "/" and "/." but I
> couldn't decipher the exact semantics of each.
>
> I think a proposal like this should not re-use the '/' symbol as we
> already have that as a path divider. (See rsync for lots of user
> confusion with a significant trailing '/').
>
> I propose a similar, but slightly different approach, where we add two
> additional symbols:
>
>   '^'	Matches the beginning of a path
>
>   '$'	Matches the end of a path
>
> [Obviously, I chose these symbols from regular expressions. I would be
> OK with alternate symbols, ('$' seems like it might be problematic in
> the shell, but perhaps not too much if it's always at the end of a
> phrase.)]
>
> This way, one could search for:
>
>   folder:foo  		Works like "folder:" historically
>
>   folder:^full/path$	Works like Jani's proposal
>
>   folder:^path/prefix	Satisfies Tomi's use case, (as well as anyone
> 			who doesn't want to have to specify or
> 			distinguish between "/cur" or "/new".
>
> Any extra '/' at the beginning or end of a search string, (such as
> "folder:^/full/path/$") would not change the semantics.
>
> Further, I think we can implement this with less database bloat by
> leaving "folder" as probabilistic and simply indexing two new terms to
> indicate the beginning of the path and the end of the path.
>
> Finally, we could also extend the scheme to other things like subject:
> to allow for an exact subject search like:
>
> 	"subject:^lib: make folder: prefix literal$"
>
> It was with an eye toward something like this that I chose to make
> folder: probabilistic in the first place. (I probably would have indexed
> things appropriately in the first place as well, but at the time doing
> the necessary query parsing for '^' and '$' seemed daunting).

Unfortunately, I haven't had the time to experiment with this. But it
bugs me that the probabilistic folder: prefix has stemming and it's case
insensitive. It's possible to work around the stemming with the anchors
you suggest or by quoting, but is there a way to have case sensitive
probabilistic prefixes?

BR,
Jani.


More information about the notmuch mailing list