[PATCH 0/7] notmuch search date:since..until query support

Jani Nikula jani at nikula.org
Fri Aug 3 14:51:45 PDT 2012


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



More information about the notmuch mailing list