This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 63afb9ae54e3d2ba9d1e24de942ab969d2d38ee2
Author: Quan Tran <hqt...@linagora.com>
AuthorDate: Fri Feb 7 12:20:16 2025 +0700

    [ENHANCEMENT] OpenSearchListeningMessageSearchIndex: option to accept 
fetching the FULL message content
    
    To allow index overrides can have the full message if needed.
    We provide an option to disable the behavior which could be optimal when 
combining with the index headers only.
---
 docs/modules/servers/pages/distributed/configure/jvm.adoc | 15 ++++++++++++++-
 .../events/OpenSearchListeningMessageSearchIndex.java     |  4 ++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/docs/modules/servers/pages/distributed/configure/jvm.adoc 
b/docs/modules/servers/pages/distributed/configure/jvm.adoc
index cbb3998dc4..745892c385 100644
--- a/docs/modules/servers/pages/distributed/configure/jvm.adoc
+++ b/docs/modules/servers/pages/distributed/configure/jvm.adoc
@@ -2,4 +2,17 @@
 :navtitle: jvm.properties
 
 :sample-configuration-prefix-url: 
https://github.com/apache/james-project/blob/master/server/apps/distributed-app/sample-configuration
-include::partial$configure/jvm.adoc[]
\ No newline at end of file
+include::partial$configure/jvm.adoc[]
+
+== Disable OpenSearchListeningMessageSearchIndex fetch full message content
+
+Whether to fetch full message content when indexing messages in OpenSearch. 
This is useful when you want to avoid fetch full message content while indexing 
only headers for example.
+
+Be careful whether the custom `OpenSearchListeningMessageSearchIndex.Indexer` 
(s) need full message content or not.
+
+Ex in `jvm.properties`:
+----
+opensearch.index.listener.fetch.full.content=false
+----
+
+Optional. Boolean. Defaults to true.
\ No newline at end of file
diff --git 
a/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java
 
b/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java
index dccead70fa..223c8da4e7 100644
--- 
a/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java
+++ 
b/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java
@@ -238,6 +238,7 @@ public class OpenSearchListeningMessageSearchIndex extends 
ListeningMessageSearc
 
     }
 
+    private static final boolean FETCH_FULL_MESSAGE_CONTENT = 
Boolean.valueOf(System.getProperty("opensearch.index.listener.fetch.full.content",
 "true"));
     private static final Logger LOGGER = 
LoggerFactory.getLogger(OpenSearchListeningMessageSearchIndex.class);
     private static final String ID_SEPARATOR = ":";
     private static final Group GROUP = new 
OpenSearchListeningMessageSearchIndexGroup();
@@ -342,6 +343,9 @@ public class OpenSearchListeningMessageSearchIndex extends 
ListeningMessageSearc
     }
 
     private FetchType chooseFetchType() {
+        if (FETCH_FULL_MESSAGE_CONTENT) {
+            return FetchType.FULL;
+        }
         if (indexBody == IndexBody.YES) {
             return FetchType.FULL;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to