Skip to content

Commit

Permalink
fixup! JAMES-4100 Improve Search Snippet display
Browse files Browse the repository at this point in the history
  • Loading branch information
hung phan committed Jan 20, 2025
1 parent 5089a3c commit 5e4df50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ public Document createMessageDocument(MailboxMessage message, MailboxSession ses
doc.add(new TextField(BCC_FIELD, uppercase(EMailers.from(headerCollection.getBccAddressSet()).serialize()), Field.Store.YES));

// index body
Optional<String> bodyText = mimePartExtracted.locateFirstTextBody().map(SearchUtil::removeGreaterThanCharacters);
Optional<String> bodyHtml = mimePartExtracted.locateFirstHtmlBody().map(SearchUtil::removeGreaterThanCharacters);
Optional<String> bodyText = mimePartExtracted.locateFirstTextBody().map(SearchUtil::removeGreaterThanCharactersAtBeginningOfLine);
Optional<String> bodyHtml = mimePartExtracted.locateFirstHtmlBody();

bodyText.or(() -> bodyHtml)
.ifPresent(bodyContent -> doc.add(new TextField(BODY_FIELD, bodyContent, Field.Store.YES)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ private Mono<IndexableMessage> instantiateIndexedMessage() throws IOException, M
.asMimePart(textExtractor)
.map(parsingResult -> {

Optional<String> bodyText = parsingResult.locateFirstTextBody().map(SearchUtil::removeGreaterThanCharacters);
Optional<String> bodyHtml = parsingResult.locateFirstHtmlBody().map(SearchUtil::removeGreaterThanCharacters);
Optional<String> bodyText = parsingResult.locateFirstTextBody().map(SearchUtil::removeGreaterThanCharactersAtBeginningOfLine);
Optional<String> bodyHtml = parsingResult.locateFirstHtmlBody();

boolean hasAttachment = MessageAttachmentMetadata.hasNonInlinedAttachment(message.getAttachments());
List<MimePart> attachments = setFlattenedAttachments(parsingResult, indexAttachments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public boolean test(MessageId input) {
};
}

public static String removeGreaterThanCharacters(String text) {
public static String removeGreaterThanCharactersAtBeginningOfLine(String text) {
StringBuilder result = new StringBuilder();
boolean isNewLine = false;

Expand Down

0 comments on commit 5e4df50

Please sign in to comment.