[MAGNOLIA-493] The highlighted search term is always displayed in lower case in the search results Created: 21/Jul/05  Updated: 17/Mar/09  Resolved: 26/Jul/05

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 2.1 Final
Fix Version/s: 2.1 Final

Type: Bug Priority: Minor
Reporter: Karsten Wintermann Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows XP, Tomcat 5.5, JDK 1.5.0_04


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

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));


 Comments   
Comment by Philipp Bracher [ 21/Jul/05 ]

commited to 2.1 branch (will merge turnk later)

Thanks a lot

Comment by Boris Kraft [ 26/Jul/05 ]

reassigned to RC3

Generated at Mon Feb 12 03:17:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.