message: fall-back to received for dateless
For the (rare) messages without a Date: header, attempt to guess a date from the top (most-recent) Received: header. Not perfect, of course, but better than nothing. Requires re-indexing to apply to already indexed messages. Should help for #1083.
This commit is contained in:
@ -741,7 +741,10 @@ fill_document(Message::Private& priv)
|
||||
doc.add(field.id, priv.ctime);
|
||||
break;
|
||||
case Field::Id::Date:
|
||||
if (const auto& date{mime_msg.date()}; date) {
|
||||
/* for the rare message without a Date: header, fall back
|
||||
* to the most recent Received: header */
|
||||
if (const auto date{mime_msg.date().or_else([&]{
|
||||
return mime_msg.received(); })}; date) {
|
||||
doc.add(field.id, date->first);
|
||||
doc.add(Field::Id::UtcOffset, date->second);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user