lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher (JIRA)" <>
Subject [jira] Closed: (LUCENE-340) [PATCH] Highlighter: Delegate output escaping to Formatter
Date Fri, 23 Sep 2005 11:10:30 GMT
     [ ]
Erik Hatcher closed LUCENE-340:

    Resolution: Fixed
     Assign To:     (was: Lucene Developers)

> [PATCH] Highlighter: Delegate output escaping to Formatter
> ----------------------------------------------------------
>          Key: LUCENE-340
>          URL:
>      Project: Lucene - Java
>         Type: Improvement
>   Components: Other
>     Versions: CVS Nightly - Specify date in submission
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Nicko Cadell
>     Priority: Minor
>  Attachments:,,, TextOutputEscaping.diff,
> Patch for jakarta-lucene-sandbox/contributions/highlighter
> CVS version 3rd February 2005
> This patch allows the highlighter Formatter to control escaping of the non
> highlighted text as well as the highlighting of the matching text.
> The example formatters highlight the matching text using XML/HTML tags. This
> works fine if the plain text does not contain any characters that need to be
> escaped for HTML output (i.e. <, &, and "), however this cannot be guaranteed.
> As the formatter controls the method of highlighting (in the examples this is
> HTML, but it could be any other form of markup) it should also be responsible
> for escaping the rest of the output.
> This patch adds a method, encodeText(String), to the Formatter interface. This
> is a breaking change. This method is called from the Highlighter with the text
> that is not passed to the formatter's highlightTerm method. 
> The SimpleHTMLFormatter has a public static method for performing simple HTML
> escaping called htmlEncode. 
> The SimpleHTMLFormatter, GradientFormatter, and SpanGradientFormatter have been
> updated to implement the encodeText method and call the htmlEncode method to
> escape the output.
> For existing formatter to maintain exactly the same behaviour as before applying
> this patch they would need to implement the encodeText method to return the
> argument value without modification, e.g.:
> public String encodeText(String originalText)
> {
>   return originalText;
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message