From 34b8fecb459567e452676c48c6040449bff08732 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Thu, 13 Sep 2012 15:33:12 +0200 Subject: [PATCH] Re: [PATCH v3 6/9] lib: add date range query support --- 40/601210abc1f1630b9b3de3594645492e5c53d2 | 125 ++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 40/601210abc1f1630b9b3de3594645492e5c53d2 diff --git a/40/601210abc1f1630b9b3de3594645492e5c53d2 b/40/601210abc1f1630b9b3de3594645492e5c53d2 new file mode 100644 index 000000000..072d66e53 --- /dev/null +++ b/40/601210abc1f1630b9b3de3594645492e5c53d2 @@ -0,0 +1,125 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 36CD4431FAF + for ; Thu, 13 Sep 2012 06:33:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Hgf-cwZCkxKQ for ; + Thu, 13 Sep 2012 06:33:29 -0700 (PDT) +Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com + [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 726BD431FAE + for ; Thu, 13 Sep 2012 06:33:29 -0700 (PDT) +Received: by qcpx40 with SMTP id x40so2227693qcp.26 + for ; Thu, 13 Sep 2012 06:33:26 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type:x-gm-message-state; + bh=2RbYP5a1EjoMxdHLUT4oQhORDduM+poqTyi2LUM/tU4=; + b=GUUbSX624zM/GTKCAlCWz5xofLzcZikG5eYyZsindt6QYf8NLwo/ue1na+XmThavMg + 1nBEUQ/4+SEmizQvSab4STL8WaLg1+ub9AIl1zHkUigYUKPvsNk6wdBFldUMmDLN8uzS + lEvgmV8EXPjgVmim4Z26Ni+m7QUH+db6mrj0dRvXW+ndbqMfDbS7BZaZPp+whgBO1po5 + TDYFr7tsVQ/dfIaD4pzXAo81q2DVnVF1bVl9gB4raLA94896XPz2RavmnjY1uyYbDmqV + W7LeDeqXov+omzJtFVQSu2m6dWkpcEbToOL0iY36usiuGmml38uUxTSb32RICyI4zOdc + i8gA== +Received: by 10.224.70.141 with SMTP id d13mr5464101qaj.99.1347543206662; + Thu, 13 Sep 2012 06:33:26 -0700 (PDT) +Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) + by mx.google.com with ESMTPS id + dg10sm14046837qab.12.2012.09.13.06.33.21 + (version=SSLv3 cipher=OTHER); Thu, 13 Sep 2012 06:33:25 -0700 (PDT) +From: Jani Nikula +To: Tomi Ollila , Michal Nazarewicz , + notmuch@notmuchmail.org, David Bremner +Subject: Re: [PATCH v3 6/9] lib: add date range query support +In-Reply-To: +References: + <532340d05ea748518c021048900bb83149e04e88.1347484177.git.jani@nikula.org> + +User-Agent: Notmuch/0.14+43~gd23e654 (http://notmuchmail.org) Emacs/23.2.1 + (x86_64-pc-linux-gnu) +Date: Thu, 13 Sep 2012 15:33:12 +0200 +Message-ID: <874nn2rqsn.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQnVZ5+FC71tp3Pp4CFMccijjbz8nMfBOR5xm4sD9fDh8qTR0bX4xpJMqp9Gfqtig2eWpjvS +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 13 Sep 2012 13:33:30 -0000 + +On Thu, 13 Sep 2012, Tomi Ollila wrote: +> On Thu, Sep 13 2012, Michal Nazarewicz wrote: +> +>> On Wed, Sep 12 2012, Jani Nikula wrote: +>>> Add a custom value range processor to enable date and time searches of +>>> the form date:since..until, where "since" and "until" are expressions +>>> understood by the previously added date/time parser, to restrict the +>>> results to messages within a particular time range (based on the Date: +>>> header). +>>> +>>> If "since" or "until" describes date/time at an accuracy of days or +>>> less, the values are rounded according to the accuracy, towards past +>>> for "since" and towards future for "until". For example, +>>> date:november..yesterday would match from the beginning of November +>>> until the end of yesterday. Expressions such as date:today..today +>>> means since the beginning of today until the end of today. +>> +>> IMO this is totally unintuitive and not how the range should work. +>> date:foo..bar should return messages whose date >= foo and < bar. So +>> for instance date:november..yesterday should return messages whose date +>> is > 2012/11/01 00:00:00 and < 2012/09/12 00:00:00. So to get +>> yesterdays messages one would do: date:yesterday..today. +> +> +> I find yesterday..yesterday to return whole yesterday's messages more +> intuitive than that returning zero messages and requiring yesterday..today +> to see messages sent yesterday. However, I've noticed that range +> described as -1day..-1day (if that syntax is/were supported) +> that would be a bit confusing (In yesterday's case I think the length +> of 'yesterday' is 24h, but in '-1day' the lenght is one second +> (or something)) + +"yesterday" equals "1 day", so you can use date:yesterday..yesterday and +date:1d..1d interchangeably. + +> Anyway, this just emphasizes that this is confusing matter; we need +> a good idiom to comprehend this issue... + +I find "since" rounding towards past and "until" rounding towards future +a very simple rule. But YMMV. + +One technical aspect is preparing for handling date:expr *without* +range, for example date:yesterday, in the future (this is currently not +supported by xapian). Intuitively that should mean all messages received +yesterday. Because the date parser does not see the range (or lack of +it) at all (and this is very much by design), the glue layer in notmuch +lib between the parser and xapian should handle it gracefully, with no +understanding of expr itself. The obvious and simple way to handle that +is to just duplicate expr on both sides of the range, and date:yesterday +would equal date:yesterday..yesterday, in a way that is very simple to +implement and explain to users. + + +BR, +Jani. -- 2.26.2