public class HighlightBuilder extends AbstractHighlighterBuilder<HighlightBuilder>
SearchSourceBuilder.highlight()
Modifier and Type | Class and Description |
---|---|
static class |
HighlightBuilder.BoundaryScannerType |
static class |
HighlightBuilder.Field |
static class |
HighlightBuilder.Order |
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ENCODER
the default encoder setting
|
static boolean |
DEFAULT_FORCE_SOURCE
default for whether to highlight fields based on the source even if stored separately
|
static int |
DEFAULT_FRAGMENT_CHAR_SIZE
the default number of fragments size in characters
|
static boolean |
DEFAULT_HIGHLIGHT_FILTER
default for whether fvh should provide highlighting on filter clauses
|
static int |
DEFAULT_NO_MATCH_SIZE
default for fragment size when there are no matches
|
static int |
DEFAULT_NUMBER_OF_FRAGMENTS
the default number of fragments for highlighting
|
static int |
DEFAULT_PHRASE_LIMIT
default for the maximum number of phrases the fvh will consider
|
static java.lang.String[] |
DEFAULT_POST_TAGS
the default closing tag
|
static java.lang.String[] |
DEFAULT_PRE_TAGS
the default opening tag
|
static boolean |
DEFAULT_REQUIRE_FIELD_MATCH
default for whether a field should be highlighted only if a query matches that field
|
static boolean |
DEFAULT_SCORE_ORDERED
default for highlight fragments being ordered by score
|
static java.lang.String[] |
DEFAULT_STYLED_POST_TAGS
the default closing tags when tag_schema = "styled"
|
static java.lang.String[] |
DEFAULT_STYLED_PRE_TAG
the default opening tags when tag_schema = "styled"
|
BOUNDARY_CHARS_FIELD, BOUNDARY_MAX_SCAN_FIELD, BOUNDARY_SCANNER_FIELD, BOUNDARY_SCANNER_LOCALE_FIELD, boundaryChars, boundaryMaxScan, boundaryScannerLocale, boundaryScannerType, ENCODER_FIELD, FIELDS_FIELD, FORCE_SOURCE_FIELD, forceSource, FRAGMENT_OFFSET_FIELD, FRAGMENT_SIZE_FIELD, fragmenter, FRAGMENTER_FIELD, fragmentSize, HIGHLIGHT_FILTER_FIELD, HIGHLIGHT_QUERY_FIELD, highlighterType, highlightFilter, highlightQuery, MATCHED_FIELDS_FIELD, NO_MATCH_SIZE_FIELD, noMatchSize, NUMBER_OF_FRAGMENTS_FIELD, numOfFragments, options, OPTIONS_FIELD, order, ORDER_FIELD, PHRASE_LIMIT_FIELD, phraseLimit, POST_TAGS_FIELD, postTags, PRE_TAGS_FIELD, preTags, REQUIRE_FIELD_MATCH_FIELD, requireFieldMatch, TYPE_FIELD
EMPTY_PARAMS
Constructor and Description |
---|
HighlightBuilder() |
HighlightBuilder(StreamInput in)
Read from a stream.
|
Modifier and Type | Method and Description |
---|---|
SearchContextHighlight |
build(QueryShardContext context) |
protected boolean |
doEquals(HighlightBuilder other)
fields only present in subclass should be checked for equality in the implementation
|
protected int |
doHashCode()
fields only present in subclass should contribute to hashCode in the implementation
|
protected void |
doWriteTo(StreamOutput out) |
java.lang.String |
encoder()
Getter for
encoder(String) |
HighlightBuilder |
encoder(java.lang.String encoder)
Set encoder for the highlighting
are styled and default.
|
HighlightBuilder |
field(HighlightBuilder.Field field) |
HighlightBuilder |
field(java.lang.String name)
Adds a field to be highlighted with default fragment size of 100 characters, and
default number of fragments of 5 using the default encoder
|
HighlightBuilder |
field(java.lang.String name,
int fragmentSize)
Adds a field to be highlighted with a provided fragment size (in characters), and
default number of fragments of 5.
|
HighlightBuilder |
field(java.lang.String name,
int fragmentSize,
int numberOfFragments)
Adds a field to be highlighted with a provided fragment size (in characters), and
a provided (maximum) number of fragments.
|
HighlightBuilder |
field(java.lang.String name,
int fragmentSize,
int numberOfFragments,
int fragmentOffset)
Adds a field to be highlighted with a provided fragment size (in characters), and
a provided (maximum) number of fragments.
|
java.util.List<HighlightBuilder.Field> |
fields() |
static HighlightBuilder |
fromXContent(QueryParseContext c) |
void |
innerXContent(XContentBuilder builder) |
HighlightBuilder |
tagsSchema(java.lang.String schemaName)
Set a tag scheme that encapsulates a built in pre and post tags.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
java.lang.Boolean |
useExplicitFieldOrder()
Gets value set with
useExplicitFieldOrder(boolean) |
HighlightBuilder |
useExplicitFieldOrder(boolean useExplicitFieldOrder)
Send the fields to be highlighted using a syntax that is specific about the order in which they should be highlighted.
|
boundaryChars, boundaryChars, boundaryMaxScan, boundaryMaxScan, boundaryScannerLocale, boundaryScannerLocale, boundaryScannerType, boundaryScannerType, boundaryScannerType, equals, forceSource, forceSource, fragmenter, fragmenter, fragmentSize, fragmentSize, hashCode, highlighterType, highlighterType, highlightFilter, highlightFilter, highlightQuery, highlightQuery, noMatchSize, noMatchSize, numOfFragments, numOfFragments, options, options, order, order, order, phraseLimit, phraseLimit, postTags, postTags, preTags, preTags, requireFieldMatch, requireFieldMatch, writeTo
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final boolean DEFAULT_FORCE_SOURCE
public static final boolean DEFAULT_REQUIRE_FIELD_MATCH
public static final boolean DEFAULT_HIGHLIGHT_FILTER
public static final boolean DEFAULT_SCORE_ORDERED
public static final java.lang.String DEFAULT_ENCODER
public static final int DEFAULT_PHRASE_LIMIT
public static final int DEFAULT_NO_MATCH_SIZE
public static final int DEFAULT_NUMBER_OF_FRAGMENTS
public static final int DEFAULT_FRAGMENT_CHAR_SIZE
public static final java.lang.String[] DEFAULT_PRE_TAGS
public static final java.lang.String[] DEFAULT_POST_TAGS
public static final java.lang.String[] DEFAULT_STYLED_PRE_TAG
public static final java.lang.String[] DEFAULT_STYLED_POST_TAGS
public HighlightBuilder()
public HighlightBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
protected void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class AbstractHighlighterBuilder<HighlightBuilder>
java.io.IOException
public HighlightBuilder field(java.lang.String name)
name
- The field to highlightpublic HighlightBuilder field(java.lang.String name, int fragmentSize)
name
- The field to highlightfragmentSize
- The size of a fragment in characterspublic HighlightBuilder field(java.lang.String name, int fragmentSize, int numberOfFragments)
name
- The field to highlightfragmentSize
- The size of a fragment in charactersnumberOfFragments
- The (maximum) number of fragmentspublic HighlightBuilder field(java.lang.String name, int fragmentSize, int numberOfFragments, int fragmentOffset)
name
- The field to highlightfragmentSize
- The size of a fragment in charactersnumberOfFragments
- The (maximum) number of fragmentsfragmentOffset
- The offset from the start of the fragment to the start of the highlightpublic HighlightBuilder field(HighlightBuilder.Field field)
public java.util.List<HighlightBuilder.Field> fields()
public HighlightBuilder tagsSchema(java.lang.String schemaName)
schemaName
- The tag scheme namepublic HighlightBuilder encoder(java.lang.String encoder)
encoder
- namepublic java.lang.String encoder()
encoder(String)
public HighlightBuilder useExplicitFieldOrder(boolean useExplicitFieldOrder)
public java.lang.Boolean useExplicitFieldOrder()
useExplicitFieldOrder(boolean)
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
toXContent
in class AbstractHighlighterBuilder<HighlightBuilder>
java.io.IOException
public static HighlightBuilder fromXContent(QueryParseContext c)
public SearchContextHighlight build(QueryShardContext context) throws java.io.IOException
java.io.IOException
public void innerXContent(XContentBuilder builder) throws java.io.IOException
innerXContent
in class AbstractHighlighterBuilder<HighlightBuilder>
java.io.IOException
protected int doHashCode()
AbstractHighlighterBuilder
doHashCode
in class AbstractHighlighterBuilder<HighlightBuilder>
protected boolean doEquals(HighlightBuilder other)
AbstractHighlighterBuilder
doEquals
in class AbstractHighlighterBuilder<HighlightBuilder>