about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-21 01:52:58 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-22 00:12:39 +0000
commit8e52e5fdea416d6fda0b8d301144af0c043a5a76 (patch)
treedafe724cfb77f00e8cb50d89a2f03b50d8c330cb /lib/PublicInbox/SearchIdx.pm
parent54590383027a67d11953690cbb6390347757730b (diff)
downloadpublic-inbox-8e52e5fdea416d6fda0b8d301144af0c043a5a76.tar.gz
We want to rely on Date: to sort messages within individual
threads since it keeps messages from git-send-email(1) sorted.
However, since developers occasionally have the clock set
wrong on their machines, sort overall messages by the newest
date in a Received: header so the landing page isn't forever
polluted by messages from the future.

This also gives us determinism for commit times in most cases,
as we'll used the Received: timestamp there, as well.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r--lib/PublicInbox/SearchIdx.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 3d80b002..ef723a4b 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -134,7 +134,9 @@ sub add_values ($$) {
         my $lines = $values->[PublicInbox::Search::LINES];
         add_val($doc, PublicInbox::Search::LINES, $lines);
 
-        my $yyyymmdd = strftime('%Y%m%d', gmtime($ts));
+        my $ds = $values->[PublicInbox::Search::DS];
+        add_val($doc, PublicInbox::Search::DS, $ds);
+        my $yyyymmdd = strftime('%Y%m%d', gmtime($ds));
         add_val($doc, PublicInbox::Search::YYYYMMDD, $yyyymmdd);
 }
 
@@ -298,7 +300,7 @@ sub add_message {
                 }
 
                 my $lines = $mime->body_raw =~ tr!\n!\n!;
-                my @values = ($smsg->ts, $num, $bytes, $lines);
+                my @values = ($smsg->ds, $num, $bytes, $lines, $smsg->ts);
                 add_values($doc, \@values);
 
                 my $tg = $self->term_generator;