public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterBuilder<?>> extends ToXContentToBytes implements Writeable
HighlightBuilder
and HighlightBuilder.Field
and provides the common setters, equality, hashCode calculation and common serializationWriteable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
|
AbstractHighlighterBuilder() |
protected |
AbstractHighlighterBuilder(StreamInput in)
Read from a stream.
|
Modifier and Type | Method and Description |
---|---|
char[] |
boundaryChars() |
HB |
boundaryChars(char[] boundaryChars)
When using the highlighterType fvh this setting
defines what constitutes a boundary for highlighting.
|
java.lang.Integer |
boundaryMaxScan() |
HB |
boundaryMaxScan(java.lang.Integer boundaryMaxScan)
When using the highlighterType fvh this setting
controls how far to look for boundary characters, and defaults to 20.
|
java.util.Locale |
boundaryScannerLocale() |
HB |
boundaryScannerLocale(java.lang.String boundaryScannerLocale)
When using the highlighterType fvh and boundaryScannerType break_iterator, this setting
controls the locale to use by the BreakIterator, defaults to "root".
|
HighlightBuilder.BoundaryScannerType |
boundaryScannerType() |
HB |
boundaryScannerType(HighlightBuilder.BoundaryScannerType boundaryScannerType)
When using the highlighterType fvh this setting
controls which scanner to use for fragment boundaries, and defaults to "simple".
|
HB |
boundaryScannerType(java.lang.String boundaryScannerType)
When using the highlighterType fvh this setting
controls which scanner to use for fragment boundaries, and defaults to "simple".
|
protected abstract boolean |
doEquals(HB other)
fields only present in subclass should be checked for equality in the implementation
|
protected abstract int |
doHashCode()
fields only present in subclass should contribute to hashCode in the implementation
|
protected abstract void |
doWriteTo(StreamOutput out) |
boolean |
equals(java.lang.Object obj) |
java.lang.Boolean |
forceSource() |
HB |
forceSource(java.lang.Boolean forceSource)
Forces the highlighting to highlight fields based on the source even if fields are stored separately.
|
java.lang.String |
fragmenter() |
HB |
fragmenter(java.lang.String fragmenter)
Sets what fragmenter to use to break up text that is eligible for highlighting.
|
java.lang.Integer |
fragmentSize() |
HB |
fragmentSize(java.lang.Integer fragmentSize)
Set the fragment size in characters, defaults to
HighlightBuilder.DEFAULT_FRAGMENT_CHAR_SIZE |
int |
hashCode() |
java.lang.String |
highlighterType() |
HB |
highlighterType(java.lang.String highlighterType)
Set type of highlighter to use.
|
java.lang.Boolean |
highlightFilter() |
HB |
highlightFilter(java.lang.Boolean highlightFilter)
Set this to true when using the highlighterType fvh
and you want to provide highlighting on filter clauses in your
query.
|
QueryBuilder |
highlightQuery() |
HB |
highlightQuery(QueryBuilder highlightQuery)
Sets a query to be used for highlighting instead of the search query.
|
protected abstract void |
innerXContent(XContentBuilder builder) |
java.lang.Integer |
noMatchSize() |
HB |
noMatchSize(java.lang.Integer noMatchSize)
Sets the size of the fragment to return from the beginning of the field if there are no matches to
highlight and the field doesn't also define noMatchSize.
|
java.lang.Integer |
numOfFragments() |
HB |
numOfFragments(java.lang.Integer numOfFragments)
Set the number of fragments, defaults to
HighlightBuilder.DEFAULT_NUMBER_OF_FRAGMENTS |
java.util.Map<java.lang.String,java.lang.Object> |
options() |
HB |
options(java.util.Map<java.lang.String,java.lang.Object> options)
Allows to set custom options for custom highlighters.
|
HighlightBuilder.Order |
order() |
HB |
order(HighlightBuilder.Order scoreOrdered)
By default, fragments of a field are ordered by the order in the highlighted text.
|
HB |
order(java.lang.String order)
The order of fragments per field.
|
java.lang.Integer |
phraseLimit() |
HB |
phraseLimit(java.lang.Integer phraseLimit)
Sets the maximum number of phrases the fvh will consider if the field doesn't also define phraseLimit.
|
java.lang.String[] |
postTags() |
HB |
postTags(java.lang.String... postTags)
Set the post tags that will be used for highlighting.
|
java.lang.String[] |
preTags() |
HB |
preTags(java.lang.String... preTags)
Set the pre tags that will be used for highlighting.
|
java.lang.Boolean |
requireFieldMatch() |
HB |
requireFieldMatch(java.lang.Boolean requireFieldMatch)
Set to true to cause a field to be highlighted only if a query matches that field.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
write common parameters to
StreamOutput |
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final ParseField PRE_TAGS_FIELD
public static final ParseField POST_TAGS_FIELD
public static final ParseField FIELDS_FIELD
public static final ParseField ORDER_FIELD
public static final ParseField HIGHLIGHT_FILTER_FIELD
public static final ParseField FRAGMENT_SIZE_FIELD
public static final ParseField FRAGMENT_OFFSET_FIELD
public static final ParseField NUMBER_OF_FRAGMENTS_FIELD
public static final ParseField ENCODER_FIELD
public static final ParseField REQUIRE_FIELD_MATCH_FIELD
public static final ParseField BOUNDARY_SCANNER_FIELD
public static final ParseField BOUNDARY_MAX_SCAN_FIELD
public static final ParseField BOUNDARY_CHARS_FIELD
public static final ParseField BOUNDARY_SCANNER_LOCALE_FIELD
public static final ParseField TYPE_FIELD
public static final ParseField FRAGMENTER_FIELD
public static final ParseField NO_MATCH_SIZE_FIELD
public static final ParseField FORCE_SOURCE_FIELD
public static final ParseField PHRASE_LIMIT_FIELD
public static final ParseField OPTIONS_FIELD
public static final ParseField HIGHLIGHT_QUERY_FIELD
public static final ParseField MATCHED_FIELDS_FIELD
protected java.lang.String[] preTags
protected java.lang.String[] postTags
protected java.lang.Integer fragmentSize
protected java.lang.Integer numOfFragments
protected java.lang.String highlighterType
protected java.lang.String fragmenter
protected QueryBuilder highlightQuery
protected HighlightBuilder.Order order
protected java.lang.Boolean highlightFilter
protected java.lang.Boolean forceSource
protected HighlightBuilder.BoundaryScannerType boundaryScannerType
protected java.lang.Integer boundaryMaxScan
protected char[] boundaryChars
protected java.util.Locale boundaryScannerLocale
protected java.lang.Integer noMatchSize
protected java.lang.Integer phraseLimit
protected java.util.Map<java.lang.String,java.lang.Object> options
protected java.lang.Boolean requireFieldMatch
public AbstractHighlighterBuilder()
protected AbstractHighlighterBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public final void writeTo(StreamOutput out) throws java.io.IOException
StreamOutput
protected abstract void doWriteTo(StreamOutput out) throws java.io.IOException
java.io.IOException
public HB preTags(java.lang.String... preTags)
public java.lang.String[] preTags()
preTags(String...)
public HB postTags(java.lang.String... postTags)
public java.lang.String[] postTags()
postTags(String...)
public HB fragmentSize(java.lang.Integer fragmentSize)
HighlightBuilder.DEFAULT_FRAGMENT_CHAR_SIZE
public java.lang.Integer fragmentSize()
fragmentSize(Integer)
public HB numOfFragments(java.lang.Integer numOfFragments)
HighlightBuilder.DEFAULT_NUMBER_OF_FRAGMENTS
public java.lang.Integer numOfFragments()
numOfFragments(Integer)
public HB highlighterType(java.lang.String highlighterType)
public java.lang.String highlighterType()
highlighterType(String)
public HB fragmenter(java.lang.String fragmenter)
SimpleFragmenter
and
SimpleSpanFragmenter
implementations respectively with the default being "span"public java.lang.String fragmenter()
fragmenter(String)
public HB highlightQuery(QueryBuilder highlightQuery)
public QueryBuilder highlightQuery()
highlightQuery(QueryBuilder)
public HB order(java.lang.String order)
public HB order(HighlightBuilder.Order scoreOrdered)
HighlightBuilder.Order.SCORE
, this changes order to score of the fragments.public HighlightBuilder.Order order()
#order(Order)
public HB highlightFilter(java.lang.Boolean highlightFilter)
public java.lang.Boolean highlightFilter()
highlightFilter(Boolean)
public HB boundaryScannerType(java.lang.String boundaryScannerType)
public HB boundaryScannerType(HighlightBuilder.BoundaryScannerType boundaryScannerType)
public HighlightBuilder.BoundaryScannerType boundaryScannerType()
boundaryScannerType(String)
public HB boundaryMaxScan(java.lang.Integer boundaryMaxScan)
public java.lang.Integer boundaryMaxScan()
boundaryMaxScan(Integer)
public HB boundaryChars(char[] boundaryChars)
public char[] boundaryChars()
boundaryChars(char[])
public HB boundaryScannerLocale(java.lang.String boundaryScannerLocale)
public java.util.Locale boundaryScannerLocale()
boundaryScannerLocale(String)
public HB options(java.util.Map<java.lang.String,java.lang.Object> options)
public java.util.Map<java.lang.String,java.lang.Object> options()
options(Map)
public HB requireFieldMatch(java.lang.Boolean requireFieldMatch)
public java.lang.Boolean requireFieldMatch()
requireFieldMatch(Boolean)
public HB noMatchSize(java.lang.Integer noMatchSize)
noMatchSize
- integer to set or null to leave out of request. default is null.public java.lang.Integer noMatchSize()
noMatchSize(Integer)
public HB phraseLimit(java.lang.Integer phraseLimit)
phraseLimit
- maximum number of phrases the fvh will considerpublic java.lang.Integer phraseLimit()
phraseLimit(Integer)
public HB forceSource(java.lang.Boolean forceSource)
public java.lang.Boolean forceSource()
forceSource(Boolean)
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
protected abstract void innerXContent(XContentBuilder builder) throws java.io.IOException
java.io.IOException
public final int hashCode()
hashCode
in class java.lang.Object
protected abstract int doHashCode()
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected abstract boolean doEquals(HB other)