You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2026/08/04 21:16:19 UTC
(tika) branch TIKA-4806-pst-mapi-storage-dates created (now 86c7a5e106)
This is an automated email from the ASF dual-hosted git repository.
tballison pushed a change to branch TIKA-4806-pst-mapi-storage-dates
in repository https://gitbox.apache.org/repos/asf/tika.git
at 86c7a5e106 TIKA-4806 -- avoid overwriting dc terms with mapi properties that aren't a great fit
This branch includes the following new commits:
new 86c7a5e106 TIKA-4806 -- avoid overwriting dc terms with mapi properties that aren't a great fit
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(tika) 01/01: TIKA-4806 -- avoid overwriting dc terms with mapi properties that aren't a great fit
Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch TIKA-4806-pst-mapi-storage-dates
in repository https://gitbox.apache.org/repos/asf/tika.git
commit 86c7a5e1062f1716a41a39a7966ef986f7d0433d
Author: tallison <ta...@apache.org>
AuthorDate: Tue Aug 4 17:15:59 2026 -0400
TIKA-4806 -- avoid overwriting dc terms with mapi properties that aren't a great fit
---
tika-core/src/main/java/org/apache/tika/metadata/MAPI.java | 7 +++++++
.../org/apache/tika/metadata/metadata-key-fields.json | 3 +++
.../apache/tika/parser/microsoft/pst/PSTMailItemParser.java | 13 +++++++++++--
.../tika/parser/microsoft/pst/OutlookPSTParserTest.java | 8 ++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/tika-core/src/main/java/org/apache/tika/metadata/MAPI.java b/tika-core/src/main/java/org/apache/tika/metadata/MAPI.java
index b748d46045..74657ce85b 100644
--- a/tika-core/src/main/java/org/apache/tika/metadata/MAPI.java
+++ b/tika-core/src/main/java/org/apache/tika/metadata/MAPI.java
@@ -52,6 +52,13 @@ public interface MAPI {
// PidTagClientSubmitTime -- distinct MAPI prop from the provider-side SUBMISSION_ACCEPTED_AT_TIME.
Property CLIENT_SUBMIT_TIME = Property.internalDate(PREFIX_MAPI_META + "msg-client-submit-time");
+ // CREATED/MODIFIED fallback when no CLIENT_SUBMIT_TIME.
+ Property MESSAGE_DELIVERY_TIME = Property.internalDate(PREFIX_MAPI_META + "message-delivery-time");
+
+ // Storage-level timestamps, not content dates -- don't use for CREATED/MODIFIED (TIKA-4798).
+ Property CREATION_TIME = Property.internalDate(PREFIX_MAPI_META + "creation-time");
+ Property LAST_MODIFICATION_TIME = Property.internalDate(PREFIX_MAPI_META + "last-modification-time");
+
Property SUBMISSION_ID = Property.internalText(PREFIX_MAPI_META + "msg-submission-id");
Property INTERNET_MESSAGE_ID = Property.internalText(PREFIX_MAPI_META + "internet-message-id");
diff --git a/tika-metadata-schema/src/main/resources/org/apache/tika/metadata/metadata-key-fields.json b/tika-metadata-schema/src/main/resources/org/apache/tika/metadata/metadata-key-fields.json
index e4ca11e01e..a21e2755c7 100644
--- a/tika-metadata-schema/src/main/resources/org/apache/tika/metadata/metadata-key-fields.json
+++ b/tika-metadata-schema/src/main/resources/org/apache/tika/metadata/metadata-key-fields.json
@@ -189,6 +189,7 @@
{"class":"org.apache.tika.metadata.MAPI","field":"CLIENT_SUBMIT_TIME","key":"mapi:msg-client-submit-time"},
{"class":"org.apache.tika.metadata.MAPI","field":"CONVERSATION_INDEX","key":"mapi:conversation-index"},
{"class":"org.apache.tika.metadata.MAPI","field":"CONVERSATION_TOPIC","key":"mapi:conversation-topic"},
+ {"class":"org.apache.tika.metadata.MAPI","field":"CREATION_TIME","key":"mapi:creation-time"},
{"class":"org.apache.tika.metadata.MAPI","field":"FROM_REPRESENTING_EMAIL","key":"mapi:from-representing-email"},
{"class":"org.apache.tika.metadata.MAPI","field":"FROM_REPRESENTING_NAME","key":"mapi:from-representing-name"},
{"class":"org.apache.tika.metadata.MAPI","field":"IMPORTANCE","key":"mapi:importance"},
@@ -196,8 +197,10 @@
{"class":"org.apache.tika.metadata.MAPI","field":"INTERNET_REFERENCES","key":"mapi:internet-references"},
{"class":"org.apache.tika.metadata.MAPI","field":"IN_REPLY_TO_ID","key":"mapi:in-reply-to-id"},
{"class":"org.apache.tika.metadata.MAPI","field":"IS_FLAGGED","key":"mapi:is-flagged"},
+ {"class":"org.apache.tika.metadata.MAPI","field":"LAST_MODIFICATION_TIME","key":"mapi:last-modification-time"},
{"class":"org.apache.tika.metadata.MAPI","field":"MESSAGE_CLASS","key":"mapi:message-class"},
{"class":"org.apache.tika.metadata.MAPI","field":"MESSAGE_CLASS_RAW","key":"mapi:message-class-raw"},
+ {"class":"org.apache.tika.metadata.MAPI","field":"MESSAGE_DELIVERY_TIME","key":"mapi:message-delivery-time"},
{"class":"org.apache.tika.metadata.MAPI","field":"PRIORTY","key":"mapi:priority"},
{"class":"org.apache.tika.metadata.MAPI","field":"RECIPIENTS_STRING","key":"mapi:recipients-string"},
{"class":"org.apache.tika.metadata.MAPI","field":"SENT_BY_SERVER_TYPE","key":"mapi:sent-by-server-type"},
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/pst/PSTMailItemParser.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/pst/PSTMailItemParser.java
index e2f66d9399..55ef1eea9b 100644
--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/pst/PSTMailItemParser.java
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/pst/PSTMailItemParser.java
@@ -20,6 +20,7 @@ import static java.lang.String.valueOf;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.util.Date;
import java.util.Set;
import com.pff.PSTAttachment;
@@ -138,9 +139,17 @@ public class PSTMailItemParser implements Parser {
metadata.set(TikaCoreProperties.SUBJECT, pstMail.getSubject());
metadata.set(Metadata.MESSAGE_FROM, pstMail.getSenderName());
metadata.set(TikaCoreProperties.CREATOR, pstMail.getSenderName());
- metadata.set(TikaCoreProperties.CREATED, pstMail.getCreationTime());
+ //creation/last-modification are storage timestamps, not content dates (TIKA-4798)
+ Date messageDate = pstMail.getClientSubmitTime();
+ if (messageDate == null) {
+ messageDate = pstMail.getMessageDeliveryTime();
+ }
+ metadata.set(TikaCoreProperties.CREATED, messageDate);
+ metadata.set(TikaCoreProperties.MODIFIED, messageDate);
metadata.set(MAPI.CLIENT_SUBMIT_TIME, pstMail.getClientSubmitTime());
- metadata.set(TikaCoreProperties.MODIFIED, pstMail.getLastModificationTime());
+ metadata.set(MAPI.MESSAGE_DELIVERY_TIME, pstMail.getMessageDeliveryTime());
+ metadata.set(MAPI.CREATION_TIME, pstMail.getCreationTime());
+ metadata.set(MAPI.LAST_MODIFICATION_TIME, pstMail.getLastModificationTime());
metadata.set(TikaCoreProperties.COMMENTS, pstMail.getComment());
metadata.set(PST.DESCRIPTOR_NODE_ID, valueOf(pstMail.getDescriptorNodeId()));
metadata.set(Message.MESSAGE_FROM_EMAIL, pstMail.getSenderEmailAddress());
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/pst/OutlookPSTParserTest.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/pst/OutlookPSTParserTest.java
index 6c94ab19dd..619a7d62bf 100644
--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/pst/OutlookPSTParserTest.java
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/pst/OutlookPSTParserTest.java
@@ -79,6 +79,14 @@ public class OutlookPSTParserTest extends TikaTest {
assertEquals("Jörn Kottmann", m1.get(MAPI.FROM_REPRESENTING_NAME));
assertEquals("kottmann@gmail.com", m1.get(MAPI.FROM_REPRESENTING_EMAIL));
assertEquals("NOTE", m1.get(MAPI.MESSAGE_CLASS));
+ //TIKA-4806: CREATED/MODIFIED reflect the client submit time, not the storage-level
+ //PidTagLastModificationTime (2014-02-26T12:37:43Z), which is ~5 hours later here.
+ assertEquals("2014-02-26T07:50:04Z", m1.get(TikaCoreProperties.CREATED));
+ assertEquals("2014-02-26T07:50:04Z", m1.get(TikaCoreProperties.MODIFIED));
+ assertEquals("2014-02-26T07:50:04Z", m1.get(MAPI.CLIENT_SUBMIT_TIME));
+ assertEquals("2014-02-26T07:51:02Z", m1.get(MAPI.CREATION_TIME));
+ assertEquals("2014-02-26T12:37:43Z", m1.get(MAPI.LAST_MODIFICATION_TIME));
+ assertEquals("2014-02-26T07:51:02Z", m1.get(MAPI.MESSAGE_DELIVERY_TIME));
assertEquals("/Début du fichier de données Outlook/Re: Feature Generators.msg",
m1.get(TikaCoreProperties.INTERNAL_PATH));
//test that subject is making it into the xhtml