unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Cc: amdragon@mit.edu
Subject: Re: [RFC PATCH 3/3] lib: add gnulib get_date() based date range search
Date: Mon, 15 Aug 2011 11:30:36 +0200	[thread overview]
Message-ID: <87aabbyqbn.fsf@steelpick.2x.cz> (raw)
In-Reply-To: <8ed532337c898d9075bbce00a7b2aaf9f13283b0.1312964528.git.jani@nikula.org>

On Wed, 10 Aug 2011, Jani Nikula wrote:
> Add a custom value range processor to handle "date:" using get_date() from
> gnulib. This enables date (and time) searches of the form
> date:since..until, where "since" and "until" are expressions understood by
> get_date(), compatible with most GNU programs. For the date input formats,
> see the GNU coreutils manual:
> http://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html
> 
> Open-ended ranges are supported (since Xapian 1.2.1), i.e. you can specify
> date:..until or date:since.. to not limit the start or end date,
> respectively.
> 
> Note: The get_date() function has been renamed to parse_datetime() in
> recent gnulib.
> 
> EXAMPLES:
> 
> date:2-weeks-ago..
> date:today00:00:00..
> date:yesterday00:00:00..today00:00:00
> date:07/14/2011..2011-07-15
> 
> BUGS/CAVEATS:
> 
> At the moment it seems search phrases with spaces in them are not supported
> in notmuch. For date: this means you can't specify a date with an
> expression with spaces in it. In many (but apparently not all) cases you
> can work around this by replacing spaces with '-' or simply leaving out
> whitespace. For example, date:2-days-ago..yesterday00:00:00.

For other search operators you can quote the arguments. Doesn't that work
here as well? E.g. date:"2 days ago..". 

> 
> For the purpose of searching mail, the get_date() implementation has some
> surprising interpretations. For example:
> 
> * Any date specification without time, such as date:yesterday.. or
>   date:2011-08-10.., means that day at the same time as now (instead of
>   00:00:00).

Yes, this is annoying. I think that the approach outlined in my previous
mail (id:87bovryqp0.fsf@steelpick.2x.cz) would solve this nicely.

> * As a consequence, ranges such as date:yesterday..yesterday match just the
>   messages at the same time as now, to the second. The date parser should
>   optimally make different kind of interpretations depending on whether
>   parsing "since" or "until". For example, date:today..today should cover
>   the whole day from beginning to end, date:today00:00:00..today23:59:59.
> 
> * date:monday.. means date:next-monday.. (rather than date:last-monday..)
> 
> * date:this-week.. really means date:now.. (you probably want
>   date:1-week-ago-next-monday00:00:00.. or similar).

I looked into that in the past and found the place where it can be
changed, but as you point out below, we would lose compatibility with
GNU and we would need to test it. I believe that writing a new parser
that is more tailored to email searching is better then reusing date
parser for things it was not intended for.

-Michal

> 
> However, there is value in being compatible with GNU programs, and the
> input formats have been rather well documented. It would be more surprising
> to deviate from that, and it would also take some effort to do so,
> including testing.

  reply	other threads:[~2011-08-15  9:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 10:22 [RFC PATCH 0/3] add user friendly date range search Jani Nikula
2011-08-10 10:22 ` [RFC PATCH 1/3] Import date/time parser from GNU coreutils Jani Nikula
2011-08-10 10:22 ` [RFC PATCH 2/3] Compile the date/time parser into notmuch library Jani Nikula
2011-08-10 10:22 ` [RFC PATCH 3/3] lib: add gnulib get_date() based date range search Jani Nikula
2011-08-15  9:30   ` Michal Sojka [this message]
2011-08-15  9:22 ` [RFC PATCH 0/3] add user friendly " Michal Sojka
2011-08-23 16:39   ` Jason Woofenden
2011-08-23 16:53     ` Tomi Ollila

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=87aabbyqbn.fsf@steelpick.2x.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=amdragon@mit.edu \
    --cc=jani@nikula.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).