Interface MatchHighlighter.FieldValueHighlighter
-
- Enclosing class:
- MatchHighlighter
public static interface MatchHighlighter.FieldValueHighlighter
Actual per-field highlighter. Field highlighters are probed whether they are applicable to a particular combination of (field, hasMatches) pair. If a highlighter declares it is applicable, itsformat(java.lang.String, java.lang.String[], java.lang.String, java.util.List<org.apache.lucene.search.matchhighlight.OffsetRange>, java.util.List<org.apache.lucene.search.matchhighlight.MatchHighlighter.QueryOffsetRange>)
method is invoked and the result is returned as the field's value.- See Also:
FieldValueHighlighters
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Collection<String>
alwaysFetchedFields()
List<String>
format(String field, String[] values, String contiguousValue, List<OffsetRange> valueRanges, List<MatchHighlighter.QueryOffsetRange> matchOffsets)
Do format field values appropriately.boolean
isApplicable(String field, boolean hasMatches)
Check if this highlighter can be applied to a given field.default MatchHighlighter.FieldValueHighlighter
or(MatchHighlighter.FieldValueHighlighter other)
Returns a new field value highlighter that is a combination of this one and another one.
-
-
-
Method Detail
-
isApplicable
boolean isApplicable(String field, boolean hasMatches)
Check if this highlighter can be applied to a given field.- Parameters:
field
- Field namehasMatches
-true
if the field has a non-empty set of match regions.
-
format
List<String> format(String field, String[] values, String contiguousValue, List<OffsetRange> valueRanges, List<MatchHighlighter.QueryOffsetRange> matchOffsets)
Do format field values appropriately.
-
alwaysFetchedFields
default Collection<String> alwaysFetchedFields()
- Returns:
- Returns a set of fields that must be fetched for each document, regardless of whether they had matches or not. This is useful to load and return certain fields that should always be included (identifiers, document titles, etc.).
-
or
default MatchHighlighter.FieldValueHighlighter or(MatchHighlighter.FieldValueHighlighter other)
Returns a new field value highlighter that is a combination of this one and another one.
-
-