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 10c84125ea0f6113077f39bbcf15c8313ce85e20
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Tue Sep 16 22:47:45 2025 +0200

    JAMES-4057 Use PLAIN highlighter as it better handle phrase match (part of 
query string)
---
 .../apache/james/mailbox/opensearch/search/OpenSearchSearcher.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearcher.java
 
b/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearcher.java
index a4144022bf..3d61f747a8 100644
--- 
a/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearcher.java
+++ 
b/mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearcher.java
@@ -40,9 +40,11 @@ import 
org.apache.james.mailbox.searchhighligt.SearchHighlighterConfiguration;
 import org.opensearch.client.opensearch._types.SortOptions;
 import org.opensearch.client.opensearch._types.Time;
 import org.opensearch.client.opensearch.core.SearchRequest;
+import org.opensearch.client.opensearch.core.search.BuiltinHighlighterType;
 import org.opensearch.client.opensearch.core.search.Highlight;
 import org.opensearch.client.opensearch.core.search.HighlightField;
 import org.opensearch.client.opensearch.core.search.HighlighterEncoder;
+import org.opensearch.client.opensearch.core.search.HighlighterType;
 import org.opensearch.client.opensearch.core.search.Hit;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -81,7 +83,8 @@ public class OpenSearchSearcher {
             .preTags(searchHighlighterConfiguration.preTagFormatter())
             .postTags(searchHighlighterConfiguration.postTagFormatter())
             .fragmentSize(searchHighlighterConfiguration.fragmentSize())
-            .numberOfFragments(1)
+            .numberOfFragments(2)
+            .type(new 
HighlighterType.Builder().builtin(BuiltinHighlighterType.Plain).build())
             .build();
 
         this.highlightQuery = new Highlight.Builder()


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

Reply via email to