public class HitHighlighter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_HIGHLIGHT_TAG
Default HTML tag for highlight hits
|
protected String |
highlightTag
the current HTML tag used for hit highlighting
|
| Constructor and Description |
|---|
HitHighlighter()
Create a new HitHighlighter object.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getHighlightTag()
Get the current HTML tag used for phrase highlighting.
|
String |
highlight(String text,
List<List<Integer>> hits)
Surround the
hits in the provided text with an HTML tag. |
void |
setHighlightTag(String highlightTag)
Set the current HTML tag used for phrase highlighting.
|
protected String |
tag(boolean closeTag)
Format the current
highlightTag by adding < and >. |
public static final String DEFAULT_HIGHLIGHT_TAG
protected String highlightTag
public String highlight(String text, List<List<Integer>> hits)
hits in the provided text with an HTML tag. This is used with offsets
from the search API to support the highlighting of query terms.text - of the Tweet to highlighthits - A List of highlighting offsets (themselves lists of two elements)protected String tag(boolean closeTag)
highlightTag by adding < and >. If closeTag is true
then the tag returned will include a / to signify a closing tag.true - if this is a closing tag, false otherwisepublic String getHighlightTag()
public void setHighlightTag(String highlightTag)
new - HTML tag (without < or >)Copyright © 2015. All rights reserved.