chibenwa commented on code in PR #2583: URL: https://github.com/apache/james-project/pull/2583#discussion_r1903911269
########## 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: I have doubts about char iteration method. Maybe we could bench with JMH this version and the REGEXP one? -- 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