|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.core.query.lucene.DefaultHighlighter
public class DefaultHighlighter
This is an adapted version of the FulltextHighlighter
posted in
issue: LUCENE-644.
Field(String, String, Field.Store, Field.Index, Field.TermVector)
where the
last argument is either Field.TermVector#WITH_POSITIONS_OFFSETS
or
Field.TermVector.WITH_OFFSETS
TermPositionVector
,
TermFreqVector
Field Summary | |
---|---|
static int |
DEFAULT_MAXFRAGMENTS
A default value of 3 |
static int |
DEFAULT_SURROUND
A default value of 75 |
static String |
END_EXCERPT
|
static String |
END_FRAGMENT_SEPARATOR
|
static String |
END_HIGHLIGHT
|
static String |
START_EXCERPT
|
static String |
START_FRAGMENT_SEPARATOR
|
static String |
START_HIGHLIGHT
|
Constructor Summary | |
---|---|
protected |
DefaultHighlighter()
|
Method Summary | |
---|---|
protected String |
createDefaultExcerpt(String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
int maxLength)
Creates a default excerpt with the given text. |
protected String |
doHighlight(org.apache.lucene.index.TermPositionVector tvec,
Set<org.apache.lucene.index.Term[]> queryTerms,
String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
String hlStart,
String hlEnd,
int maxFragments,
int surround)
|
protected String |
escape(String input)
Escapes input text suitable for the output format. |
static String |
highlight(org.apache.lucene.index.TermPositionVector tvec,
Set<org.apache.lucene.index.Term[]> queryTerms,
String text,
int maxFragments,
int surround)
|
static String |
highlight(org.apache.lucene.index.TermPositionVector tvec,
Set<org.apache.lucene.index.Term[]> queryTerms,
String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
String hlStart,
String hlEnd,
int maxFragments,
int surround)
|
protected String |
mergeFragments(org.apache.lucene.index.TermVectorOffsetInfo[] offsets,
String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
String hlStart,
String hlEnd,
int maxFragments,
int surround)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAXFRAGMENTS
public static final int DEFAULT_SURROUND
public static final String START_EXCERPT
public static final String END_EXCERPT
public static final String START_FRAGMENT_SEPARATOR
public static final String END_FRAGMENT_SEPARATOR
public static final String START_HIGHLIGHT
public static final String END_HIGHLIGHT
Constructor Detail |
---|
protected DefaultHighlighter()
Method Detail |
---|
public static String highlight(org.apache.lucene.index.TermPositionVector tvec, Set<org.apache.lucene.index.Term[]> queryTerms, String text, String excerptStart, String excerptEnd, String fragmentStart, String fragmentEnd, String hlStart, String hlEnd, int maxFragments, int surround) throws IOException
tvec
- the term position vector for this hitqueryTerms
- the query terms.text
- the original text that was used to create the
tokens.excerptStart
- this string is prepended to the excerptexcerptEnd
- this string is appended to the excerptfragmentStart
- this string is prepended to every fragmentfragmentEnd
- this string is appended to the end of every
fragement.hlStart
- the string used to prepend a highlighted token, for
example "<b>"hlEnd
- the string used to append a highlighted token, for
example "</b>"maxFragments
- the maximum number of fragmentssurround
- the maximum number of chars surrounding a
highlighted token
IOException
public static String highlight(org.apache.lucene.index.TermPositionVector tvec, Set<org.apache.lucene.index.Term[]> queryTerms, String text, int maxFragments, int surround) throws IOException
tvec
- the term position vector for this hitqueryTerms
- the query terms.text
- the original text that was used to create the tokens.maxFragments
- the maximum number of fragmentssurround
- the maximum number of chars surrounding a highlighted
token
IOException
protected String doHighlight(org.apache.lucene.index.TermPositionVector tvec, Set<org.apache.lucene.index.Term[]> queryTerms, String text, String excerptStart, String excerptEnd, String fragmentStart, String fragmentEnd, String hlStart, String hlEnd, int maxFragments, int surround) throws IOException
IOException
highlight(TermPositionVector, Set, String, String, String, String, String, String, String, int, int)
protected String mergeFragments(org.apache.lucene.index.TermVectorOffsetInfo[] offsets, String text, String excerptStart, String excerptEnd, String fragmentStart, String fragmentEnd, String hlStart, String hlEnd, int maxFragments, int surround) throws IOException
IOException
protected String createDefaultExcerpt(String text, String excerptStart, String excerptEnd, String fragmentStart, String fragmentEnd, int maxLength) throws IOException
text
- the text.excerptStart
- the excerpt start.excerptEnd
- the excerpt end.fragmentStart
- the fragment start.fragmentEnd
- the fragment end.maxLength
- the maximum length of the fragment.
IOException
- if an error occurs while reading from the text.protected String escape(String input)
By default does XML-escaping. Can be overridden for other formats.
input
- raw text.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |