|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.search.postingshighlight.PassageFormatter
org.apache.lucene.search.postingshighlight.DefaultPassageFormatter
public class DefaultPassageFormatter
Creates a formatted snippet from the top passages.
The default implementation marks the query terms as bold, and places ellipses between unconnected passages.
| Field Summary | |
|---|---|
protected String |
ellipsis
text that will appear between two unconnected passages |
protected boolean |
escape
true if we should escape for html |
protected String |
postTag
text that will appear after highlighted terms |
protected String |
preTag
text that will appear before highlighted terms |
| Constructor Summary | |
|---|---|
DefaultPassageFormatter()
Creates a new DefaultPassageFormatter with the default tags. |
|
DefaultPassageFormatter(String preTag,
String postTag,
String ellipsis,
boolean escape)
Creates a new DefaultPassageFormatter with custom tags. |
|
| Method Summary | |
|---|---|
protected void |
append(StringBuilder dest,
String content,
int start,
int end)
Appends original text to the response. |
String |
format(Passage[] passages,
String content)
Formats the top passages from content
into a human-readable text snippet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final String preTag
protected final String postTag
protected final String ellipsis
protected final boolean escape
| Constructor Detail |
|---|
public DefaultPassageFormatter()
public DefaultPassageFormatter(String preTag,
String postTag,
String ellipsis,
boolean escape)
preTag - text which should appear before a highlighted term.postTag - text which should appear after a highlighted term.ellipsis - text which should be used to connect two unconnected passages.escape - true if text should be html-escaped| Method Detail |
|---|
public String format(Passage[] passages,
String content)
PassageFormatterpassages from content
into a human-readable text snippet.
format in class PassageFormatterpassages - top-N passages for the field. Note these are sorted in
the order that they appear in the document for convenience.content - content for the field.
protected void append(StringBuilder dest,
String content,
int start,
int end)
dest - resulting text, possibly transformed or encodedcontent - original text contentstart - index of the first character in contentend - index of the character following the last character in content
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||