GSearch: solve the truncated special characters problem. Proposed by Leire Urcelay:
When doing a search, the fields having field.lenght > fieldMaxLength are truncated using getBestFragments method.
If the field contains some special characters, like ', it can happen that this special character is cut.
For example, the field “Il est donc intéressant de se pencher sur l'acquisition” is transformed into “Il est donc intéressant de se pencher sur l &apos ... “.
This transformation should produce an error during the XSLT transformation. Currently, this is not the case, since there is a strange transformation in the code. In fact, all “&” characters are transformed in “#” character.
You can see it in the method executeQuery of the class Statement.java:
snippets = highlighter.getBestFragments(tokenStream, f.stringValue(), snippetsMax, " ... ");
snippets = snippets.replace('&', '#');
Due to this character replacement, there is not any error in the xsl transformation, but however, there is a problem when displaying the result. Instead of getting:
“Il est donc intéressant de se pencher sur l’ ...”
The following is displayed:
“Il est donc intéressant de se pencher sur l #apos ...”
The current solution with '#' was a tradeoff. A more satisfactory solution should be included in the next version of GSearch.