Details
-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
3.0.5
-
None
-
None
-
Any
Description
The stripHtmlTags() method of the SearchResultSnippetTag class should not simply strip all HTML tags. Line breaks should be replaced by white space.This can be simply done by searching & replacing line break tags first, then stripping all remaining HTML tags:
protected String stripHtmlTags(String resultString) {
resultString = resultString.replaceAll("
<br>", " ");
resultString = resultString.replaceAll("
<br/>", " ");
resultString = resultString.replaceAll("
<br />", " ");
resultString = resultString.replaceAll("
<BR>", " ");
resultString = resultString.replaceAll("
<BR/>", " ");
resultString = resultString.replaceAll("
<BR />", " ");
return resultString.replaceAll("\\<(.?\\s)*
>", StringUtils.EMPTY); //$NON-NLS-1$
}
I'm sure one could also achive the same with a single regex statement.