|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CompassHighlighter
A highlighter tool that can highlight hits in a given text based on an executed query.
CompassHits.highlighter(int)| Nested Class Summary | |
|---|---|
static class |
CompassHighlighter.TextTokenizer
Controls the way text will be tokenized in order to perform the highlight operation. |
| Method Summary | |
|---|---|
String |
fragment(String propertyName)
Returns the best highlighted fragment for the given property name / meta-data. |
String |
fragment(String propertyName,
String text)
Returns the best highlighted fragment for the given property name / meta-data. |
String[] |
fragments(String propertyName)
Returns the best highlighted fragments for the given property name / meta-data. |
String[] |
fragments(String propertyName,
String text)
Returns the best highlighted fragments for the given property name / meta-data. |
String |
fragmentsWithSeparator(String propertyName)
Returns the best highlighted fragments for the given property name / meta-data, separated with the given separator. |
String |
fragmentsWithSeparator(String propertyName,
String text)
Returns the best highlighted fragments for the given property name / meta-data, separated with the given separator. |
String[] |
multiValueFragment(String propertyName)
Returns the best highlighted fragment of each matching multi resource property name / meta-data (i.e.: when there is more then one property of the same name). |
String[] |
multiValueFragment(String propertyName,
String[] texts)
Returns the best highlighted fragment of each matching multi resource property name / meta-data (i.e.: when there is more then one property of the same name). |
String |
multiValueFragmentWithSeparator(String propertyName)
Returns the best highlighted fragments for the given multi property name / meta-data, separated with the given separator. |
String |
multiValueFragmentWithSeparator(String propertyName,
String[] texts)
Returns the best highlighted fragments for the given multi property name / meta-data, separated with the given separator. |
CompassHighlighter |
setAnalyzer(Resource resource)
Sets the analyzer that will be used if analysis of the text is needed (see CompassHighlighter.TextTokenizer). |
CompassHighlighter |
setAnalyzer(String analyzerName)
Sets the analyzer that will be used if analysis of the text is needed (see CompassHighlighter.TextTokenizer). |
CompassHighlighter |
setHighlighter(String highlighterName)
Sets the highlighter that will be used out the ones set in the configuration. |
CompassHighlighter |
setMaxBytesToAnalyze(int maxBytesToAnalyze)
Sets the maximum number of bytes that will be analyzed for highlighting. |
CompassHighlighter |
setMaxNumFragments(int maxNumFragments)
Sets the maximum number of fragments that can be returned or combined to a separator. |
CompassHighlighter |
setSeparator(String separator)
Sets the separator string that will be used to combine different fragments in fragmentsWithSeparator(String). |
CompassHighlighter |
setTextTokenizer(CompassHighlighter.TextTokenizer textTokenizer)
Sets how the text will be tokenized for highlighting. |
| Method Detail |
|---|
CompassHighlighter setHighlighter(String highlighterName)
throws CompassException
default.
highlighterName - The name of the highlighter that will be used
CompassException
CompassHighlighter setAnalyzer(String analyzerName)
throws CompassException
CompassHighlighter.TextTokenizer).
analyzerName - The analyzer name that will be used.
CompassException
CompassHighlighter setAnalyzer(Resource resource)
throws CompassException
CompassHighlighter.TextTokenizer). Uses the resource to derive the analyzer
that will be used (works also with per resource property analyzer).
resource - The resource to derive the analyzer from
CompassException
CompassHighlighter setSeparator(String separator)
throws CompassException
fragmentsWithSeparator(String). If not set, will
use the separator configured for the chosen highlighter.
separator - The separator used
CompassException
CompassHighlighter setMaxBytesToAnalyze(int maxBytesToAnalyze)
throws CompassException
maxBytesToAnalyze - The maximum number of bytes analyzed for highlighting
CompassException
CompassHighlighter setMaxNumFragments(int maxNumFragments)
throws CompassException
maxNumFragments - The maximum number if fragments
CompassException
CompassHighlighter setTextTokenizer(CompassHighlighter.TextTokenizer textTokenizer)
throws CompassException
textTokenizer - How the text will be tokenized for highlighting
CompassException
String fragment(String propertyName)
throws CompassException
Note, if there are more than one resource property name / meta-data with the same name, the text will be taken from the first one.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.
CompassException
String fragment(String propertyName,
String text)
throws CompassException
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
String[] fragments(String propertyName)
throws CompassException
Note, that the number of fragments will be between 0 and
maxNumFragments.
Note, if there are more than one resource property name / meta-data with the same name, the text will be taken from the first one.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.
CompassException
String[] fragments(String propertyName,
String text)
throws CompassException
Note, that the number of fragments will be between 0 and
maxNumFragments.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
String fragmentsWithSeparator(String propertyName)
throws CompassException
Note, that the number of fragments will be between 0 and
maxNumFragments.
Note, if there are more than one resource property name / meta-data with the same name, the text will be taken from the first one.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.
CompassException
String fragmentsWithSeparator(String propertyName,
String text)
throws CompassException
Note, that the number of fragments will be between 0 and
maxNumFragments.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
String[] multiValueFragment(String propertyName)
throws CompassException
Note, that the number of returned fragments is not limited by
maxNumFragments value.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.
CompassException
String[] multiValueFragment(String propertyName,
String[] texts)
throws CompassException
Note, that the number of returned fragments is not limited by
maxNumFragments value.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.texts - Texts to be highlighted.
CompassException
String multiValueFragmentWithSeparator(String propertyName)
throws CompassException
Note, that the number of separeted fragments is not
limited by maxNumFragments value.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.
CompassException
String multiValueFragmentWithSeparator(String propertyName,
String[] texts)
throws CompassException
Note, that the number of fragments contained in returned string is not
limited by maxNumFragments value.
The name can either be the actual resource property or meta-data value, or the path to the given resource property (alias.rProperty), or the class property (alias.cProperty) or the path to the meta-data (alias.cProperty.metaData)
propertyName - The resource property name / meta-data.texts - Texts to be highlighted.
CompassException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||