about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-05 21:45:28 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-06 21:18:38 +0000
commit936670cb83971bf250571a7dd9b0a0a0b33babd8 (patch)
tree675fa79206f5c1e9f3a13052ddd9d28b69fa67ca /lib/PublicInbox/Search.pm
parent9d6468d9560b8cd26ba2529d7a09a93ec5ad8c00 (diff)
downloadpublic-inbox-936670cb83971bf250571a7dd9b0a0a0b33babd8.tar.gz
Dscho found this useful for finding matching git commits based
on AuthorDate in git.  Add it to the overview DB format, too;
 so in the future we can support v2 repos without Xapian.

https://public-inbox.org/git/nycvar.QRO.7.76.6.1804041821420.55@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz
https://public-inbox.org/git/alpine.DEB.2.20.1702041206130.3496@virtualbox/
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 9eb07284..34ebd1a6 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -9,7 +9,8 @@ use warnings;
 
 # values for searching
 use constant TS => 0;  # Received: header in Unix time
-use constant YYYYMMDD => 1; # for searching in the WWW UI
+use constant YYYYMMDD => 1; # Date: header for searching in the WWW UI
+use constant DT => 2; # Date: YYYYMMDDHHMMSS
 
 use Search::Xapian qw/:standard/;
 use PublicInbox::SearchMsg;
@@ -89,6 +90,9 @@ date range as YYYYMMDD  e.g. d:19931002..20101002
 Open-ended ranges such as d:19931002.. and d:..20101002
 are also supported
 EOF
+        'dt:' => <<EOF,
+date-time range as YYYYMMDDhhmmss (e.g. dt:19931002011000..19931002011200)
+EOF
         'b:' => 'match within message body, including text attachments',
         'nq:' => 'match non-quoted text within message body',
         'q:' => 'match quoted text within message body',
@@ -258,6 +262,8 @@ sub qp {
         $qp->set_stemming_strategy(STEM_SOME);
         $qp->add_valuerangeprocessor(
                 Search::Xapian::NumberValueRangeProcessor->new(YYYYMMDD, 'd:'));
+        $qp->add_valuerangeprocessor(
+                Search::Xapian::NumberValueRangeProcessor->new(DT, 'dt:'));
 
         while (my ($name, $prefix) = each %bool_pfx_external) {
                 $qp->add_boolean_prefix($name, $prefix);