From: Jani Nikula Date: Fri, 3 Aug 2012 21:51:45 +0000 (+0300) Subject: [PATCH 0/7] notmuch search date:since..until query support X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e10bbb4ab83c97e716f3fe3535e96d46a755b212;p=notmuch-archives.git [PATCH 0/7] notmuch search date:since..until query support --- diff --git a/be/2a63583b4dd13f86777f80d05216fe76e5b36c b/be/2a63583b4dd13f86777f80d05216fe76e5b36c new file mode 100644 index 000000000..1ce32d000 --- /dev/null +++ b/be/2a63583b4dd13f86777f80d05216fe76e5b36c @@ -0,0 +1,131 @@ +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 9DC27431FAF + for ; Fri, 3 Aug 2012 14:51:58 -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 tgHJdAgnnTSI for ; + Fri, 3 Aug 2012 14:51:58 -0700 (PDT) +Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com + [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id AA7E9431FAE + for ; Fri, 3 Aug 2012 14:51:57 -0700 (PDT) +Received: by lagu2 with SMTP id u2so681800lag.26 + for ; Fri, 03 Aug 2012 14:51:56 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; + bh=HKPQnPfr1XNFoFW8Qgk92V1jXldce16ySol1O3IMbBA=; + b=YyBW3Ej0BYfUXi+nbGImWW5KC8PgAU8ARCCtA03PDNOiF7eDJylsQi+1qf49+goyma + XpoCq4l1v0PFalZSL3/iu+ZVrXiAQq+KNXvUk9e02ZjvTRZgxs1P59ojoSE/al0aVJ2f + qJsL7NqLKSFJA+DcLjtKbc5LG6sVOzRSWawH+YvpeHFxeLfua+pGfzsZQblPJmwNU6My + c8WK5xNjIuPqFcf1HLIhM5dLdS4rqatzTsGKadfXD6m5IUwWqTdW9vpkEH0m18KNF5zM + 6gsHEyVoRZPw9Ik+mTGsf7YGLhNMf4Gl1jQbIJdEpE8yJSTgs3iaSED0rcAleFzoq7H3 + Cc9A== +Received: by 10.112.30.41 with SMTP id p9mr1269272lbh.26.1344030716048; + Fri, 03 Aug 2012 14:51:56 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id lx11sm1277825lab.4.2012.08.03.14.51.53 + (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 14:51:54 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 0/7] notmuch search date:since..until query support +Date: Sat, 4 Aug 2012 00:51:45 +0300 +Message-Id: +X-Mailer: git-send-email 1.7.9.5 +X-Gm-Message-State: + ALoCoQnql+rK2iEk/v5/iMf+eVjd2uqQsxK8v/GMeC6mmsU85kx1kA5HzyOsI419XSHlXB1eJwmv +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: Fri, 03 Aug 2012 21:51:58 -0000 + +Hi all, this series adds a decent date range query support to the +notmuch lib. For example: + + $ notmuch search date:2012-01-01..2012-02-01 + $ notmuch search date:10:00..13:00 + $ notmuch search date:monday..friday + $ notmuch search date:2months5days..2weeks5hours + $ notmuch search date:last-week..yesterday + $ notmuch search date:today.. + $ notmuch search date:..today + +and so on. See the man page in patch 7 for further details. Or play with +the test tool from patch 3 to see how the parser works (try -h for +help): + + $ test/parse-time -d yesterday + Fri Aug 03 00:00:00 +0300 2012 + +The added tests are fairly limited, but things are in place for both +testing the date parser directly (using the above tool) and through +notmuch. I'm hoping these could be amended later. + +Finally, the git repo for the parser itself is at [1], with some +background info in the README [2]. I'm not sure if I'll maintain the git +repo if and when this gets merged to notmuch, but it contains the +history since the last time I submitted this. + +BR, +Jani. + +[1] https://gitorious.org/parse-time-string +[2] https://gitorious.org/parse-time-string/parse-time-string/blobs/master/README + + +Jani Nikula (7): + build: drop the -Wswitch-enum warning + lib: add a date/time parser module + test: add new test tool parse-time for date/time parser + test: add smoke tests for the date/time parser module + lib: add date range query support + test: add tests for date:since..until range queries + man: document the date:since..until range queries + + configure | 2 +- + lib/Makefile.local | 2 + + lib/database-private.h | 1 + + lib/database.cc | 5 + + lib/parse-time-string.c | 1384 +++++++++++++++++++++++++++++++++++++++ + lib/parse-time-string.h | 95 +++ + lib/parse-time-vrp.cc | 40 ++ + lib/parse-time-vrp.h | 19 + + man/man7/notmuch-search-terms.7 | 147 ++++- + test/Makefile.local | 9 +- + test/basic | 2 +- + test/notmuch-test | 2 + + test/parse-time-string | 26 + + test/parse-time.c | 145 ++++ + test/search-date | 21 + + 15 files changed, 1884 insertions(+), 16 deletions(-) + create mode 100644 lib/parse-time-string.c + create mode 100644 lib/parse-time-string.h + create mode 100644 lib/parse-time-vrp.cc + create mode 100644 lib/parse-time-vrp.h + create mode 100755 test/parse-time-string + create mode 100644 test/parse-time.c + create mode 100755 test/search-date + +-- +1.7.9.5 +