xapian: Support hour search.
authorRicardo Wurmus <rekado@elephly.net>
Wed, 22 Apr 2020 13:36:15 +0000 (15:36 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Wed, 22 Apr 2020 13:36:15 +0000 (15:36 +0200)
mumi/xapian.scm

index debee3727902e0eb6f141ebbcee093160e6fc34c..8546e7821e86365c5ee31a8834010c204c815edf 100644 (file)
@@ -137,6 +137,8 @@ messages and index their contents in the Xapian database at DBPATH."
 
 (define (sanitize-date-range token)
   (define now (current-time))
+  (define (hours n)
+    (make-time time-duration 0 (* 60 60 n)))
   (define (days n)
     (make-time time-duration 0 (* 60 60 24 n)))
   (define (range-boundary->date-string boundary*)
@@ -159,6 +161,8 @@ messages and index their contents in the Xapian database at DBPATH."
                                 (subtract-duration
                                  now
                                  (match unit
+                                   ((or "h" "hour" "hours")
+                                    (hours n))
                                    ((or "d" "day" "days")
                                     (days n))
                                    ((or "w" "week" "weeks")