Re: [RFC PATCH 0/2] natural language date range search
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 25 Feb 2012 15:05:44 +0000 (17:05 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:58 +0000 (09:44 -0800)
72/927a5ad67f1d92b3c1c97eeee786c8e8707343 [new file with mode: 0644]

diff --git a/72/927a5ad67f1d92b3c1c97eeee786c8e8707343 b/72/927a5ad67f1d92b3c1c97eeee786c8e8707343
new file mode 100644 (file)
index 0000000..cff3ba0
--- /dev/null
@@ -0,0 +1,166 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7901F431FC2\r
+       for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 20:03:55 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.804\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.804 tagged_above=-999 required=5\r
+       tests=[DATE_IN_PAST_12_24=0.804] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id CUI5v-ZRBwcU for <notmuch@notmuchmail.org>;\r
+       Sat, 25 Feb 2012 20:03:54 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
+       by olra.theworths.org (Postfix) with ESMTP id EF084431FBD\r
+       for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 20:03:53 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 3BC8168057; Sat, 25 Feb 2012 17:05:44 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC PATCH 0/2] natural language date range search\r
+In-Reply-To: <cover.1329689945.git.jani@nikula.org>\r
+References: <cover.1329689945.git.jani@nikula.org>\r
+User-Agent: Notmuch/0.11.1+225~g90fb4e8 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sat, 25 Feb 2012 17:05:44 +0200\r
+Message-ID: <m2mx87j6lz.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 26 Feb 2012 04:03:55 -0000\r
+\r
+On Mon, 20 Feb 2012 00:55:50 +0200, Jani Nikula <jani@nikula.org> wrote:\r
+> Hi all, these patches add support for natural language date range search\r
+> of the form date:since..until, where since and until can be fairly free\r
+> form date/time expressions in English.\r
+> \r
+> Examples:\r
+> \r
+> date:two-days..yesterday (all mail in the two days before today)\r
+> date:12h.. (all mail since 12 hrs ago)\r
+> date:november..november (all mail in previous november)\r
+> date:2011.. (all mail since the beginning of 2011)\r
+> date:last-week..this-week (all mail over last and current week)\r
+> date:5/10/2011-12:34:55..10pm_2012-01-14\r
+> \r
+> Plus plenty more and combinations of the above.\r
+\r
+Pretty c00l, the above and the code.\r
+\r
+> \r
+> The repository for the date/time parser with a command line tool is at\r
+> [1], and there's a README [2] with a bunch of details too.\r
+\r
+By seeing the thoughts thrown in IRC there seems to be plenty if things\r
+to resolve until something like this is going to be available in stock\r
+notmuch. In the meanwhile I provide some ideas into the soup; maybe\r
+our collective mind can have some use of this.\r
+\r
+\r
+Q: Could 'date:timestr' be converted to 'date:timestr..timestr' ?\r
+\r
+In this idea -<timestr> means relative time and <timestr> absolute\r
+time. The the time string consists of number and letter and assume\r
+the above suggestion for date:timestr (<- == date:timestr..timestr)\r
+Letters are s seconds  h hours  d days  w weeks  m months (more\r
+useful than for minutes) and  y years.\r
+\r
+date:-2000s     email exactly 2000 seconds ago (not very useful)\r
+date:-2000s..   since 2000 secs in past\r
+date:..-2000s   up to 2000 secs in past\r
+\r
+date:3600s      email with date 01:00 -- today if (local) time is\r
+                more than 1am. yesterday if less. If there is not\r
+                mail with date exactly that then no email matches\r
+                (i.e. same usefullness applies as above)\r
+date:3600s..    email with date since 01:00 (same today/yesterday\r
+                resolvation like above)\r
+\r
+date:12h..      since noon, either yesterday (time less than 12pm)\r
+                or today (currently afternoon)\r
+date:12h        like above, but since 12:00 to 13:00\r
+date:12h..12h   ditto\r
+\r
+date:6pm..      since 18:00 either today (current time > 6pm) or yesterday\r
+\r
+date:-12h..     since 12 hours ago\r
+date:-12h       since 12 hours ago to 11 hours ago\r
+\r
+date:-1h        last hour\r
+date:0h         today 12am - 01am \r
+\r
+date:-0d        today\r
+date:-0d..      ditto\r
+date:-1d        yesterday\r
+date:-1d..      yesterday & today\r
+\r
+date:-2d        2 days ago\r
+date:-2d..      day before yesterday, yesterday & today\r
+\r
+date:0d         last sunday (if today sunday, today (so being consistent))\r
+date:1d         last monday (like above)\r
+date:6d         last saturday (like above)\r
+date:7d         last sunday (same as 0d)\r
+\r
+date:-0w        current week (does week start sun or mon)\r
+date:-1w        last week (same as above)\r
+date:-2w..      since beginning of 2 weeks ago\r
+\r
+date:1w         (ISO) week number ? current week it this is same week  \r
+                number. this week last year if current week is less.\r
+date:1w..      since the above date resolved.\r
+\r
+date:11m       last november (m is more useable in month than in minute)\r
+date:11m..      since last november\r
+\r
+date:-11m       whole month 11 months ago\r
+date:-11m..    since beginning of 11 months ago\r
+\r
+date:70y       year 1970\r
+date:69y        year 2069\r
+date:0y         year 2000\r
+date:99y..      since beginning of 1999\r
+\r
+date:-0y        this year\r
+date:-1y        last year\r
+\r
+\r
+This is incomplete, but pretty easy to use format. Letters from English\r
+language. What is missing letter for month (M?) ar mday (D?). All thought\r
+as in local time...\r
+\r
+... strings could be concatenated: for example: -3d11h (meaning second\r
+always absolute). Need to be in granularity order (or something). Timezone\r
+could be added (pst, utc, eest, z -- and even like -11 or +4\r
+( -2y11m+7 meaning year 2010 november in timezone utc + 7 (this year: 2012))\r
+\r
+Of course range date:-2d..-5h would be supported.\r
+\r
+> BR,\r
+> Jani.\r
+> \r
+> \r
+> [1] https://gitorious.org/parse-time-string/parse-time-string\r
+> [2] https://gitorious.org/parse-time-string/parse-time-string/blobs/master/README\r
+> \r
+\r
+Tomi\r
+\r