Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-493

The highlighted search term is always displayed in lower case in the search results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 2.1 Final
    • 2.1 Final
    • taglibs
    • None
    • Windows XP, Tomcat 5.5, JDK 1.5.0_04

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

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              pbaerfuss Philipp Bärfuss
              kwinterm Karsten Wintermann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD