|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.impl.DefaultCompassHighlighter
public class DefaultCompassHighlighter
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.compass.core.CompassHighlighter |
|---|
CompassHighlighter.TextTokenizer |
| Constructor Summary | |
|---|---|
DefaultCompassHighlighter(InternalCompassSession session,
InternalCompassHits hits,
int n)
|
|
| 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 CompassHighlighter.fragmentsWithSeparator(String). |
CompassHighlighter |
setTextTokenizer(CompassHighlighter.TextTokenizer textTokenizer)
Sets how the text will be tokenized for highlighting. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultCompassHighlighter(InternalCompassSession session,
InternalCompassHits hits,
int n)
| Method Detail |
|---|
public CompassHighlighter setAnalyzer(String analyzerName)
throws CompassException
CompassHighlighterCompassHighlighter.TextTokenizer).
setAnalyzer in interface CompassHighlighteranalyzerName - The analyzer name that will be used.
CompassException
public CompassHighlighter setAnalyzer(Resource resource)
throws CompassException
CompassHighlighterCompassHighlighter.TextTokenizer). Uses the resource to derive the analyzer
that will be used (works also with per resource property analyzer).
setAnalyzer in interface CompassHighlighterresource - The resource to derive the analyzer from
CompassException
public CompassHighlighter setHighlighter(String highlighterName)
throws CompassException
CompassHighlighterdefault.
setHighlighter in interface CompassHighlighterhighlighterName - The name of the highlighter that will be used
CompassException
public CompassHighlighter setSeparator(String separator)
throws CompassException
CompassHighlighterCompassHighlighter.fragmentsWithSeparator(String). If not set, will
use the separator configured for the chosen highlighter.
setSeparator in interface CompassHighlighterseparator - The separator used
CompassException
public CompassHighlighter setMaxNumFragments(int maxNumFragments)
throws CompassException
CompassHighlighter
setMaxNumFragments in interface CompassHighlightermaxNumFragments - The maximum number if fragments
CompassException
public CompassHighlighter setMaxBytesToAnalyze(int maxBytesToAnalyze)
throws CompassException
CompassHighlighter
setMaxBytesToAnalyze in interface CompassHighlightermaxBytesToAnalyze - The maximum number of bytes analyzed for highlighting
CompassException
public CompassHighlighter setTextTokenizer(CompassHighlighter.TextTokenizer textTokenizer)
throws CompassException
CompassHighlighter
setTextTokenizer in interface CompassHighlightertextTokenizer - How the text will be tokenized for highlighting
CompassException
public String fragment(String propertyName)
throws CompassException
CompassHighlighterNote, 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)
fragment in interface CompassHighlighterpropertyName - The resource property name / meta-data.
CompassException
public String fragment(String propertyName,
String text)
throws CompassException
CompassHighlighterThe 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)
fragment in interface CompassHighlighterpropertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
public String[] fragments(String propertyName)
throws CompassException
CompassHighlighter
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)
fragments in interface CompassHighlighterpropertyName - The resource property name / meta-data.
CompassException
public String[] fragments(String propertyName,
String text)
throws CompassException
CompassHighlighter
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)
fragments in interface CompassHighlighterpropertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
public String fragmentsWithSeparator(String propertyName)
throws CompassException
CompassHighlighter
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)
fragmentsWithSeparator in interface CompassHighlighterpropertyName - The resource property name / meta-data.
CompassException
public String fragmentsWithSeparator(String propertyName,
String text)
throws CompassException
CompassHighlighter
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)
fragmentsWithSeparator in interface CompassHighlighterpropertyName - The resource property name / meta-data.text - The text to be highlighted.
CompassException
public String[] multiValueFragment(String propertyName)
throws CompassException
CompassHighlighter
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)
multiValueFragment in interface CompassHighlighterpropertyName - The resource property name / meta-data.
CompassException
public String[] multiValueFragment(String propertyName,
String[] texts)
throws CompassException
CompassHighlighter
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)
multiValueFragment in interface CompassHighlighterpropertyName - The resource property name / meta-data.texts - Texts to be highlighted.
CompassException
public String multiValueFragmentWithSeparator(String propertyName)
throws CompassException
CompassHighlighter
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)
multiValueFragmentWithSeparator in interface CompassHighlighterpropertyName - The resource property name / meta-data.
CompassException
public String multiValueFragmentWithSeparator(String propertyName,
String[] texts)
throws CompassException
CompassHighlighter
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)
multiValueFragmentWithSeparator in interface CompassHighlighterpropertyName - 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 | |||||||||