hungphan227 commented on code in PR #2583:
URL: https://github.com/apache/james-project/pull/2583#discussion_r1904882105


##########
mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearchHighlighter.java:
##########
@@ -100,6 +97,21 @@ private SearchSnippet buildSearchSnippet(Hit<ObjectNode> 
searchResult) {
     }
 
     private String shortenGreaterThanCharacters(String text) {
-        return GREATER_THAN_PATTERN.matcher(text).replaceAll(">");
+        StringBuilder result = new StringBuilder();
+        boolean previousIsTarget = false;
+
+        for (char c : text.toCharArray()) {

Review Comment:
   Tested both ways with JMH in an isolated test (run method 
shortenGreaterThanCharacters in a loop with 10000 iterations). Both have the 
same results (around 3ms)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to