chibenwa commented on code in PR #2583:
URL: https://github.com/apache/james-project/pull/2583#discussion_r1903851436
##########
mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/search/OpenSearchSearchHighlighter.java:
##########
@@ -90,8 +93,13 @@ private SearchSnippet buildSearchSnippet(Hit<ObjectNode>
searchResult) {
Optional<String> highlightedTextBody =
Optional.ofNullable(highlightHit.get(JsonMessageConstants.TEXT_BODY))
.or(() ->
Optional.ofNullable(highlightHit.get(JsonMessageConstants.HTML_BODY)))
.or(() ->
Optional.ofNullable(highlightHit.get(ATTACHMENT_TEXT_CONTENT_FIELD)))
- .map(List::getFirst);
+ .map(List::getFirst)
+ .map(this::shortenGreaterThanCharacters);
return new SearchSnippet(messageId, highlightedSubject,
highlightedTextBody);
}
+
+ private String shortenGreaterThanCharacters(String text) {
+ return GREATER_THAN_PATTERN.matcher(text).replaceAll(">");
+ }
Review Comment:
Could we get a shot at a non regexp implementation of this please?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]