diff options
author | Eric Wong <e@80x24.org> | 2016-08-16 08:49:26 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-08-16 21:30:57 +0000 |
commit | 1031291ec876cf3791077aa7d564a8bf8561ee1f (patch) | |
tree | a8c18a9c687e800002dd3ec798af8966face62db /lib/PublicInbox/SearchIdx.pm | |
parent | 3fc411c772a21d8faeec3fde32b101bc86190ddb (diff) | |
download | public-inbox-1031291ec876cf3791077aa7d564a8bf8561ee1f.tar.gz |
This is similar to mairix in that it uses a "d:" prefix; but only takes YYYYMMDD, for now. Using custom date/time parsers via Perl will be much more work: nntp://news.gmane.org/20151005222157.GE5880@survex.com Anyhow, this ought to be more human-friendly than searching by Unix timestamps, but it requires reindexing to take advantage of.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index f8155ecc..f54f5f2f 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -17,6 +17,7 @@ use base qw(PublicInbox::Search); use PublicInbox::MID qw/mid_clean id_compress mid_mime/; use PublicInbox::MsgIter; use Carp qw(croak); +use POSIX qw(strftime); require PublicInbox::Git; *xpfx = *PublicInbox::Search::xpfx; @@ -128,7 +129,8 @@ sub add_message { $doc->add_term(xpfx('path') . id_compress($path)); } - add_val($doc, &PublicInbox::Search::TS, $smsg->ts); + my $ts = $smsg->ts; + add_val($doc, &PublicInbox::Search::TS, $ts); defined($num) and add_val($doc, &PublicInbox::Search::NUM, $num); @@ -139,6 +141,9 @@ sub add_message { add_val($doc, &PublicInbox::Search::LINES, $mime->body_raw =~ tr!\n!\n!); + my $yyyymmdd = strftime('%Y%m%d', gmtime($ts)); + $doc->add_value(&PublicInbox::Search::YYYYMMDD, $yyyymmdd); + my $tg = $self->term_generator; $tg->set_document($doc); |