Syntactic sugar for range syntax

Jani Nikula jani at nikula.org
Thu Jun 11 10:24:36 PDT 2015


On Wed, 10 Jun 2015, Robert Künnemann <robert at kunnemann.de> wrote:
> I've been using notmuch for about a year now (using mutt-kz) and I am
> very happy with it. I have, however, a small suggestion about the range
> syntax in search queries. Often, I am looking for emails that have
> occurred, say, in the last week. The query has the following form:
>
>  date:today-1week..today

In other words, date:1w..

The reference for relative dates is "now" if one is not specified. The
minus sign means nothing, relative dates all refer to the past and are
added together.

> The following syntactic sugar could shorten this kind of queries:
>  
>  date:r -> date:r..today, if r is a relative date

You can use open ended queries date:since.. or date:..until to not limit
the end or start time.

>  date:a -> date:a..a, if a is an absolute date

This needs support from Xapian, but we've discussed this in the past and
agree on the semantics. There's a patch to make date:a..! mean the same
in the mean time:

http://mid.gmane.org/1425732959-2282-1-git-send-email-jani@nikula.org

>  date:a-r -> date:a-r..a, for combination.

I think this conflicts with the above.

> (If r is interpreted as today-r, the first two transformations are
> subsumed by the last.)
>
> For example:
>  date:today -> date:today..today
>  date:-1week -> date:-1week..today

date:1w..

>  date:24.12.2014-4w -> date:24.12.2014-4w..24.12.2014 
>
> What do you think about this suggestion? Is this something notmuch would
> do, or rather something for xapian?

What we can do in notmuch is pretty limited unless we write a full blown
custom query parser. Basically Xapian parses date: and .., and passes us
the rest to figure out.


HTH,
Jani.


>
> With kind regards, Robert Künnemann
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list