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 7901F431FC2 for ; Sat, 25 Feb 2012 20:03:55 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.804 X-Spam-Level: X-Spam-Status: No, score=0.804 tagged_above=-999 required=5 tests=[DATE_IN_PAST_12_24=0.804] 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 CUI5v-ZRBwcU for ; Sat, 25 Feb 2012 20:03:54 -0800 (PST) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id EF084431FBD for ; Sat, 25 Feb 2012 20:03:53 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id 3BC8168057; Sat, 25 Feb 2012 17:05:44 +0200 (EET) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [RFC PATCH 0/2] natural language date range search In-Reply-To: References: User-Agent: Notmuch/0.11.1+225~g90fb4e8 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Sun, 26 Feb 2012 04:03:55 -0000 On Mon, 20 Feb 2012 00:55:50 +0200, Jani Nikula wrote: > Hi all, these patches add support for natural language date range search > of the form date:since..until, where since and until can be fairly free > form date/time expressions in English. > > Examples: > > date:two-days..yesterday (all mail in the two days before today) > date:12h.. (all mail since 12 hrs ago) > date:november..november (all mail in previous november) > date:2011.. (all mail since the beginning of 2011) > date:last-week..this-week (all mail over last and current week) > date:5/10/2011-12:34:55..10pm_2012-01-14 > > Plus plenty more and combinations of the above. Pretty c00l, the above and the code. > > The repository for the date/time parser with a command line tool is at > [1], and there's a README [2] with a bunch of details too. By seeing the thoughts thrown in IRC there seems to be plenty if things to resolve until something like this is going to be available in stock notmuch. In the meanwhile I provide some ideas into the soup; maybe our collective mind can have some use of this. Q: Could 'date:timestr' be converted to 'date:timestr..timestr' ? In this idea - means relative time and absolute time. The the time string consists of number and letter and assume the above suggestion for date:timestr (<- == date:timestr..timestr) Letters are s seconds h hours d days w weeks m months (more useful than for minutes) and y years. date:-2000s email exactly 2000 seconds ago (not very useful) date:-2000s.. since 2000 secs in past date:..-2000s up to 2000 secs in past date:3600s email with date 01:00 -- today if (local) time is more than 1am. yesterday if less. If there is not mail with date exactly that then no email matches (i.e. same usefullness applies as above) date:3600s.. email with date since 01:00 (same today/yesterday resolvation like above) date:12h.. since noon, either yesterday (time less than 12pm) or today (currently afternoon) date:12h like above, but since 12:00 to 13:00 date:12h..12h ditto date:6pm.. since 18:00 either today (current time > 6pm) or yesterday date:-12h.. since 12 hours ago date:-12h since 12 hours ago to 11 hours ago date:-1h last hour date:0h today 12am - 01am date:-0d today date:-0d.. ditto date:-1d yesterday date:-1d.. yesterday & today date:-2d 2 days ago date:-2d.. day before yesterday, yesterday & today date:0d last sunday (if today sunday, today (so being consistent)) date:1d last monday (like above) date:6d last saturday (like above) date:7d last sunday (same as 0d) date:-0w current week (does week start sun or mon) date:-1w last week (same as above) date:-2w.. since beginning of 2 weeks ago date:1w (ISO) week number ? current week it this is same week number. this week last year if current week is less. date:1w.. since the above date resolved. date:11m last november (m is more useable in month than in minute) date:11m.. since last november date:-11m whole month 11 months ago date:-11m.. since beginning of 11 months ago date:70y year 1970 date:69y year 2069 date:0y year 2000 date:99y.. since beginning of 1999 date:-0y this year date:-1y last year This is incomplete, but pretty easy to use format. Letters from English language. What is missing letter for month (M?) ar mday (D?). All thought as in local time... ... strings could be concatenated: for example: -3d11h (meaning second always absolute). Need to be in granularity order (or something). Timezone could be added (pst, utc, eest, z -- and even like -11 or +4 ( -2y11m+7 meaning year 2010 november in timezone utc + 7 (this year: 2012)) Of course range date:-2d..-5h would be supported. > BR, > Jani. > > > [1] https://gitorious.org/parse-time-string/parse-time-string > [2] https://gitorious.org/parse-time-string/parse-time-string/blobs/master/README > Tomi