public class PhraseSuggestionBuilder extends SuggestionBuilder<PhraseSuggestionBuilder>
Modifier and Type | Class and Description |
---|---|
static interface |
PhraseSuggestionBuilder.CandidateGenerator
CandidateGenerator interface. |
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected static ParseField |
COLLATE_FIELD |
protected static ParseField |
COLLATE_QUERY_FIELD |
protected static ParseField |
COLLATE_QUERY_PARAMS |
protected static ParseField |
COLLATE_QUERY_PRUNE |
protected static ParseField |
CONFIDENCE_FIELD |
protected static ParseField |
FORCE_UNIGRAM_FIELD |
protected static ParseField |
GRAMSIZE_FIELD |
protected static ParseField |
HIGHLIGHT_FIELD |
protected static ParseField |
MAXERRORS_FIELD |
protected static ParseField |
POST_TAG_FIELD |
protected static ParseField |
PRE_TAG_FIELD |
protected static ParseField |
RWE_LIKELIHOOD_FIELD |
protected static ParseField |
SEPARATOR_FIELD |
protected static ParseField |
SMOOTHING_MODEL_FIELD |
protected static ParseField |
TOKEN_LIMIT_FIELD |
analyzer, ANALYZER_FIELD, field, FIELDNAME_FIELD, prefix, PREFIX_FIELD, regex, REGEX_FIELD, shardSize, SHARDSIZE_FIELD, size, SIZE_FIELD, text, TEXT_FIELD
EMPTY_PARAMS
Constructor and Description |
---|
PhraseSuggestionBuilder(StreamInput in)
Read from a stream.
|
PhraseSuggestionBuilder(java.lang.String field) |
Modifier and Type | Method and Description |
---|---|
PhraseSuggestionBuilder |
addCandidateGenerator(PhraseSuggestionBuilder.CandidateGenerator generator)
Adds a
PhraseSuggestionBuilder.CandidateGenerator to this suggester. |
SuggestionSearchContext.SuggestionContext |
build(QueryShardContext context) |
PhraseSuggestionBuilder |
clearCandidateGenerators()
Clear the candidate generators.
|
java.util.Map<java.lang.String,java.lang.Object> |
collateParams()
gets additional params for collate script
|
PhraseSuggestionBuilder |
collateParams(java.util.Map<java.lang.String,java.lang.Object> collateParams)
Adds additional parameters for collate scripts.
|
java.lang.Boolean |
collatePrune()
Gets whether to prune suggestions after collation
|
PhraseSuggestionBuilder |
collatePrune(boolean collatePrune)
Sets whether to prune suggestions after collation
|
Script |
collateQuery()
gets the query used for filtering out suggested phrases (collation).
|
PhraseSuggestionBuilder |
collateQuery(Script collateQueryTemplate)
Sets a query used for filtering out suggested phrases (collation).
|
PhraseSuggestionBuilder |
collateQuery(java.lang.String collateQuery)
Sets a query used for filtering out suggested phrases (collation).
|
java.lang.Float |
confidence()
get the
confidence() parameter |
PhraseSuggestionBuilder |
confidence(float confidence)
Sets the confidence level for this suggester.
|
protected boolean |
doEquals(PhraseSuggestionBuilder other)
Indicates whether some other
SuggestionBuilder of the same type is "equal to" this one. |
protected int |
doHashCode()
HashCode for the subclass of
SuggestionBuilder to implement. |
void |
doWriteTo(StreamOutput out) |
java.lang.Boolean |
forceUnigrams()
get the setting for
forceUnigrams() |
PhraseSuggestionBuilder |
forceUnigrams(boolean forceUnigrams)
If set to
true the phrase suggester will fail if the analyzer only
produces ngrams. |
static PhraseSuggestionBuilder |
fromXContent(XContentParser parser) |
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
java.lang.Integer |
gramSize()
get the
gramSize(int) parameter |
PhraseSuggestionBuilder |
gramSize(int gramSize)
Sets the gram size for the n-gram model used for this suggester.
|
PhraseSuggestionBuilder |
highlight(java.lang.String preTag,
java.lang.String postTag)
Setup highlighting for suggestions.
|
XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
java.lang.Float |
maxErrors()
get the maxErrors setting
|
PhraseSuggestionBuilder |
maxErrors(float maxErrors)
Sets the maximum percentage of the terms that at most considered to be
misspellings in order to form a correction.
|
java.lang.String |
postTag()
get the post-tag for the highlighter set with
highlight(String, String) |
java.lang.String |
preTag()
get the pre-tag for the highlighter set with
highlight(String, String) |
java.lang.Float |
realWordErrorLikelihood()
get the
realWordErrorLikelihood(float) parameter |
PhraseSuggestionBuilder |
realWordErrorLikelihood(float realWordErrorLikelihood)
Sets the likelihood of a term being a misspelled even if the term exists
in the dictionary.
|
java.lang.String |
separator()
get the separator that is used to separate terms in the bigram field.
|
PhraseSuggestionBuilder |
separator(java.lang.String separator)
Sets the separator that is used to separate terms in the bigram field.
|
SmoothingModel |
smoothingModel()
Gets the
SmoothingModel |
PhraseSuggestionBuilder |
smoothingModel(SmoothingModel model)
Sets an explicit smoothing model used for this suggester.
|
java.lang.Integer |
tokenLimit()
get the
tokenLimit(int) parameter |
PhraseSuggestionBuilder |
tokenLimit(int tokenLimit) |
analyzer, analyzer, equals, field, hashCode, populateCommonFields, prefix, prefix, regex, regex, shardSize, shardSize, size, size, text, text, toXContent, writeTo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFragment
protected static final ParseField MAXERRORS_FIELD
protected static final ParseField RWE_LIKELIHOOD_FIELD
protected static final ParseField SEPARATOR_FIELD
protected static final ParseField CONFIDENCE_FIELD
protected static final ParseField GRAMSIZE_FIELD
protected static final ParseField SMOOTHING_MODEL_FIELD
protected static final ParseField FORCE_UNIGRAM_FIELD
protected static final ParseField TOKEN_LIMIT_FIELD
protected static final ParseField HIGHLIGHT_FIELD
protected static final ParseField PRE_TAG_FIELD
protected static final ParseField POST_TAG_FIELD
protected static final ParseField COLLATE_FIELD
protected static final ParseField COLLATE_QUERY_FIELD
protected static final ParseField COLLATE_QUERY_PARAMS
protected static final ParseField COLLATE_QUERY_PRUNE
public PhraseSuggestionBuilder(java.lang.String field)
public PhraseSuggestionBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class SuggestionBuilder<PhraseSuggestionBuilder>
java.io.IOException
public PhraseSuggestionBuilder gramSize(int gramSize)
public java.lang.Integer gramSize()
gramSize(int)
parameterpublic PhraseSuggestionBuilder maxErrors(float maxErrors)
public java.lang.Float maxErrors()
public PhraseSuggestionBuilder separator(java.lang.String separator)
public java.lang.String separator()
public PhraseSuggestionBuilder realWordErrorLikelihood(float realWordErrorLikelihood)
public java.lang.Float realWordErrorLikelihood()
realWordErrorLikelihood(float)
parameterpublic PhraseSuggestionBuilder confidence(float confidence)
public java.lang.Float confidence()
confidence()
parameterpublic PhraseSuggestionBuilder addCandidateGenerator(PhraseSuggestionBuilder.CandidateGenerator generator)
PhraseSuggestionBuilder.CandidateGenerator
to this suggester. The
PhraseSuggestionBuilder.CandidateGenerator
is used to draw candidates for each individual
phrase term before the candidates are scored.public PhraseSuggestionBuilder clearCandidateGenerators()
public PhraseSuggestionBuilder forceUnigrams(boolean forceUnigrams)
true
the phrase suggester will fail if the analyzer only
produces ngrams. the default it true
.public java.lang.Boolean forceUnigrams()
forceUnigrams()
public PhraseSuggestionBuilder smoothingModel(SmoothingModel model)
StupidBackoff
.public SmoothingModel smoothingModel()
SmoothingModel
public PhraseSuggestionBuilder tokenLimit(int tokenLimit)
public java.lang.Integer tokenLimit()
tokenLimit(int)
parameterpublic PhraseSuggestionBuilder highlight(java.lang.String preTag, java.lang.String postTag)
public java.lang.String preTag()
highlight(String, String)
public java.lang.String postTag()
highlight(String, String)
public PhraseSuggestionBuilder collateQuery(java.lang.String collateQuery)
public PhraseSuggestionBuilder collateQuery(Script collateQueryTemplate)
public Script collateQuery()
public PhraseSuggestionBuilder collateParams(java.util.Map<java.lang.String,java.lang.Object> collateParams)
public java.util.Map<java.lang.String,java.lang.Object> collateParams()
public PhraseSuggestionBuilder collatePrune(boolean collatePrune)
public java.lang.Boolean collatePrune()
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
innerToXContent
in class SuggestionBuilder<PhraseSuggestionBuilder>
java.io.IOException
public static PhraseSuggestionBuilder fromXContent(XContentParser parser) throws java.io.IOException
java.io.IOException
public SuggestionSearchContext.SuggestionContext build(QueryShardContext context) throws java.io.IOException
build
in class SuggestionBuilder<PhraseSuggestionBuilder>
java.io.IOException
public java.lang.String getWriteableName()
NamedWriteable
protected boolean doEquals(PhraseSuggestionBuilder other)
SuggestionBuilder
SuggestionBuilder
of the same type is "equal to" this one.doEquals
in class SuggestionBuilder<PhraseSuggestionBuilder>
protected int doHashCode()
SuggestionBuilder
SuggestionBuilder
to implement.doHashCode
in class SuggestionBuilder<PhraseSuggestionBuilder>