-
Bug
-
Resolution: Fixed
-
Minor
-
2.1 Final
-
None
-
Windows XP, Tomcat 5.5, JDK 1.5.0_04
In the search results page, the highlighted search term (snippet) is always displayed in lower case letters. Also, if the search term appears in mixed case or upper case in the content, no search result snippet is displayed. For example, try searching for "jboss" in the samples.
The following patch solves the problem:
Index: SearchResultSnippetTag.java
===================================================================
— SearchResultSnippetTag.java (revision 1190)
+++ SearchResultSnippetTag.java (working copy)
@@ -185,7 +185,7 @@
// first check, avoid using heavy string replaceAll operations if the search term is not
// there
- if (!StringUtils.contains(resultString, searchTerm)) {
+ if (!StringUtils.contains(resultString.toLowerCase(), searchTerm)) { continue; }
@@ -211,7 +211,7 @@
snippet.append(StringUtils.substring(resultString, from, pos));
snippet.append("<strong>"); //$NON-NLS-1$
- snippet.append(searchTerm);
+ snippet.append(StringUtils.substring(resultString, pos, posEnd));
snippet.append("</strong>"); //$NON-NLS-1$
snippet.append(StringUtils.substring(resultString, posEnd, to));