public abstract class SuggestionBuilder<T extends SuggestionBuilder<T>> extends java.lang.Object implements NamedWriteable, ToXContent
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
analyzer |
protected static ParseField |
ANALYZER_FIELD |
protected java.lang.String |
field |
protected static ParseField |
FIELDNAME_FIELD |
protected java.lang.String |
prefix |
protected static ParseField |
PREFIX_FIELD |
protected java.lang.String |
regex |
protected static ParseField |
REGEX_FIELD |
protected java.lang.Integer |
shardSize |
protected static ParseField |
SHARDSIZE_FIELD |
protected java.lang.Integer |
size |
protected static ParseField |
SIZE_FIELD |
protected java.lang.String |
text |
protected static ParseField |
TEXT_FIELD |
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
protected |
SuggestionBuilder(StreamInput in)
Read from a stream.
|
protected |
SuggestionBuilder(java.lang.String field)
Creates a new suggestion.
|
protected |
SuggestionBuilder(java.lang.String field,
SuggestionBuilder<?> in)
internal copy constructor that copies over all class fields from second SuggestionBuilder except field name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
analyzer()
get the
analyzer() parameter |
T |
analyzer(java.lang.String analyzer)
Sets the analyzer to analyse to suggest text with.
|
protected abstract SuggestionSearchContext.SuggestionContext |
build(QueryShardContext context) |
protected abstract boolean |
doEquals(T other)
Indicates whether some other
SuggestionBuilder of the same type is "equal to" this one. |
protected abstract int |
doHashCode()
HashCode for the subclass of
SuggestionBuilder to implement. |
protected abstract void |
doWriteTo(StreamOutput out) |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
field()
get the
field() parameter |
int |
hashCode() |
protected abstract XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
protected void |
populateCommonFields(MapperService mapperService,
SuggestionSearchContext.SuggestionContext suggestionContext)
Transfers the text, prefix, regex, analyzer, field, size and shard size settings from the
original
SuggestionBuilder to the target SuggestionSearchContext.SuggestionContext |
java.lang.String |
prefix()
get the prefix for this suggestion
|
protected T |
prefix(java.lang.String prefix) |
java.lang.String |
regex()
get the regex for this suggestion
|
protected T |
regex(java.lang.String regex) |
java.lang.Integer |
shardSize()
get the
shardSize() parameter |
T |
shardSize(java.lang.Integer shardSize)
Sets the maximum number of suggested term to be retrieved from each
individual shard.
|
java.lang.Integer |
size()
get the
size() parameter |
T |
size(int size)
Sets the maximum suggestions to be returned per suggest text term.
|
java.lang.String |
text()
get the text for this suggestion
|
T |
text(java.lang.String text)
Same as in
SuggestBuilder.setGlobalText(String) , but in the suggestion scope. |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getWriteableName
isFragment
protected final java.lang.String field
protected java.lang.String text
protected java.lang.String prefix
protected java.lang.String regex
protected java.lang.String analyzer
protected java.lang.Integer size
protected java.lang.Integer shardSize
protected static final ParseField TEXT_FIELD
protected static final ParseField PREFIX_FIELD
protected static final ParseField REGEX_FIELD
protected static final ParseField FIELDNAME_FIELD
protected static final ParseField ANALYZER_FIELD
protected static final ParseField SIZE_FIELD
protected static final ParseField SHARDSIZE_FIELD
protected SuggestionBuilder(java.lang.String field)
field
- field to execute suggestions onprotected SuggestionBuilder(java.lang.String field, SuggestionBuilder<?> in)
protected SuggestionBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public final void writeTo(StreamOutput out) throws java.io.IOException
Writeable
protected abstract void doWriteTo(StreamOutput out) throws java.io.IOException
java.io.IOException
public T text(java.lang.String text)
SuggestBuilder.setGlobalText(String)
, but in the suggestion scope.public java.lang.String text()
protected T prefix(java.lang.String prefix)
public java.lang.String prefix()
protected T regex(java.lang.String regex)
public java.lang.String regex()
public java.lang.String field()
field()
parameterpublic T analyzer(java.lang.String analyzer)
public java.lang.String analyzer()
analyzer()
parameterpublic T size(int size)
public java.lang.Integer size()
size()
parameterpublic T shardSize(java.lang.Integer shardSize)
size
option. Defaults to the
size
option.
Setting this to a value higher than the `size` can be useful in order to get a more accurate document frequency for suggested terms. Due to the fact that terms are partitioned amongst shards, the shard level document frequencies of suggestions may not be precise. Increasing this will make these document frequencies more precise.
public java.lang.Integer shardSize()
shardSize()
parameterpublic XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
protected abstract XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
protected abstract SuggestionSearchContext.SuggestionContext build(QueryShardContext context) throws java.io.IOException
java.io.IOException
protected void populateCommonFields(MapperService mapperService, SuggestionSearchContext.SuggestionContext suggestionContext) throws java.io.IOException
SuggestionBuilder
to the target SuggestionSearchContext.SuggestionContext
java.io.IOException
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected abstract boolean doEquals(T other)
SuggestionBuilder
of the same type is "equal to" this one.public final int hashCode()
hashCode
in class java.lang.Object
protected abstract int doHashCode()
SuggestionBuilder
to implement.