org.apache.jackrabbit.core.query.lucene
Class WeightedHighlighter
java.lang.Object
org.apache.jackrabbit.core.query.lucene.DefaultHighlighter
org.apache.jackrabbit.core.query.lucene.WeightedHighlighter
public class WeightedHighlighter
- extends DefaultHighlighter
WeightedHighlighter
implements a highlighter that weights the
fragments based on the proximity of the highlighted terms to each other. The
returned fragments are not necessarily in sequence as the text occurs in the
content.
Method Summary |
static String |
highlight(org.apache.lucene.index.TermPositionVector tvec,
Set queryTerms,
String text,
int maxFragments,
int surround)
|
static String |
highlight(org.apache.lucene.index.TermPositionVector tvec,
Set 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 |
WeightedHighlighter
protected WeightedHighlighter()
highlight
public static String highlight(org.apache.lucene.index.TermPositionVector tvec,
Set queryTerms,
String text,
String excerptStart,
String excerptEnd,
String fragmentStart,
String fragmentEnd,
String hlStart,
String hlEnd,
int maxFragments,
int surround)
throws IOException
- Parameters:
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
- Returns:
- a String with text fragments where tokens from the query are
highlighted
- Throws:
IOException
highlight
public static String highlight(org.apache.lucene.index.TermPositionVector tvec,
Set queryTerms,
String text,
int maxFragments,
int surround)
throws IOException
- Parameters:
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
- Returns:
- a String with text fragments where tokens from the query are
highlighted
- Throws:
IOException
mergeFragments
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
- Overrides:
mergeFragments
in class DefaultHighlighter
- Throws:
IOException
Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.