[RFC PATCH 0/3] add user friendly date range search

Michal Sojka sojkam1 at fel.cvut.cz
Mon Aug 15 02:22:35 PDT 2011


Hi Jani,

On Wed, 10 Aug 2011, Jani Nikula wrote:
> Hi, this RFC series adds user friendly date range searches in notmuch.
> 
> Patches 1 and 2 add the date/time parser from coreutils, and were posted to
> the list by Michal Sojka in January [1]. I picked them up from the
> date-parser branch of the git tree at [2]. These worked without
> modifications, so I didn't touch them.
> 
> Patch 3 adds the actual date range searches on top of current
> master. Michal also posted a date search implementation, but it was based
> on Austin Clements' custom parser patches, which I haven't looked at. Also,
> this one uses date: range syntax rather than before: and after:, and I
> think Michal would agree on this one [3].

Sure.

> If the same parser is to be eventually included in notmuch, I'd prefer
> using the parse-datetime module [3] (get_date() was renamed) directly from
> gnulib [4], instead of coreutils or elsewhere that just imports from
> gnulib. Also, I think the gnulib module should be placed in a subdirectory
> rather than alongside all the notmuch lib files. However there are some
> complications in using parse-datetime, as gnulib modules heavily rely on
> autotools. Perhaps one option would be to build a separate library with
> autotools that has what we need from gnulib?

If he include this parser, then we should definitely take it from
gunlib. I was not aware of gnulib.

But, in the past I thought more about specifying dates in notmuch and
came to conclusion, that parse-datetime is probably not the best thing
to use for notmuch. The reason is that notmuch users are more interested
in date/time ranges than in individual date/times and this module parses
only individual date/times.

I would simply like notmuch to show all mails from Monday when I say
notmuch search date:monday. With parse-datetime approach I would need to
say notmuch search date:monday..tuesday or more precisely
date:"monday 0:00..tuesday 0:00".

I think that this could be implemented by having a parser that works
with ranges as primary objects. If user specifies date:range (e.g.
date:monday), the meaning would be:

  since range.start, until range.end

If the user specifies date:range1..range2 (e.g. date:monday..wednesday),
then the meaning would be:

  since range1.start, until range2.end

And of course, you could also have zero-length ranges to support
something like date:12:34:56..13:24:35.

I think that this would match most closely the way how I want to search
emails by date. Thoughts?

Unfortunately, I do not have time to implement this now so volunteers
are welcome.

-Michal


More information about the notmuch mailing list