Hi all
 
There is a keyword highlighting problem with the search on one of our
sites. It occurs when the search phrase consists of one of the
following: <, span, pan, an, ap, >  etc... (<span class="hl">)
 
The same issue occurs on the jahia site when searching "benefits span"
for example
http://www.jahia.org/jahia/Jahia/engineName/search/site/jahia_org/pid/69
?search=benefits+span&maxPageItems=10&JahiaSearchResultHandlerImpl.oneHi
tByPage=false
 
Has anyone managed to fix this issue?
 
Code snippets from declarations.jsp
 
    String STRING_BEFORE_SEARCH = "<span class='hl'>";
    String STRING_AFTER_SEARCH = "</span>";
 
for (int  k = 0; k < searchStrings.length; k++){
            result = new StringBuffer(str.length() + 100);
            searchString  =
JahiaTools.replacePattern(searchStrings[k],"*","");
            lcStr = str.toLowerCase();
            lcsearchString = searchString.toLowerCase();
            startOfIndex = 0;
            i = lcStr.indexOf(lcsearchString,startOfIndex);
            int searchStringLength = searchString.length();
            while (i != -1) {
                result.append(str.substring(startOfIndex, i));
                result.append(STRING_BEFORE_SEARCH);
                result.append(str.substring(i, i + searchStringLength)
);
                result.append(STRING_AFTER_SEARCH);
                startOfIndex = i + searchStringLength;
                i = lcStr.indexOf(lcsearchString,startOfIndex);
            }
            result.append(str.substring(startOfIndex,str.length()));
            str = result.toString();
        }
 
Bojana
_________________________________________________________________________________________________________

IMPORTANT: This e-mail, including any attachments, may contain private or 
confidential information. 
If you think you may not be the intended recipient, or if you have received 
this e-mail in error, 
please contact the sender immediately and delete all copies of this e-mail. If 
you are not the intended 
recipient, you must not reproduce any part of this e-mail or disclose its 
contents to any other party.
This email represents the views of the individual sender, which do not 
necessarily reflect those of 
education.au limited except where the sender expressly states otherwise.
It is your responsibility to scan this email and any files transmitted with it 
for viruses or any other 
defects.
education.au limited will not be liable for any loss, damage or consequence 
caused directly or indirectly by this email.

Reply via email to