Class PhraseSuggestionBuilder
java.lang.Object
org.elasticsearch.search.suggest.SuggestionBuilder<PhraseSuggestionBuilder>
org.elasticsearch.search.suggest.phrase.PhraseSuggestionBuilder
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
Defines the actual suggest command for phrase suggestions (
phrase).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePhraseSuggestionBuilder.CandidateGeneratorinterface.Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldprotected static org.elasticsearch.common.xcontent.ParseFieldstatic Stringprotected static org.elasticsearch.common.xcontent.ParseFieldFields inherited from class org.elasticsearch.search.suggest.SuggestionBuilder
analyzer, ANALYZER_FIELD, field, FIELDNAME_FIELD, prefix, PREFIX_FIELD, regex, REGEX_FIELD, shardSize, SHARDSIZE_FIELD, size, SIZE_FIELD, text, TEXT_FIELDFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds aPhraseSuggestionBuilder.CandidateGeneratorto this suggester.build(SearchExecutionContext context)Clear the candidate generators.gets additional params for collate scriptcollateParams(Map<String,Object> collateParams)Adds additional parameters for collate scripts.Gets whether to prune suggestions after collationcollatePrune(boolean collatePrune)Sets whether to prune suggestions after collationgets the query used for filtering out suggested phrases (collation).collateQuery(String collateQuery)Sets a query used for filtering out suggested phrases (collation).collateQuery(Script collateQueryTemplate)Sets a query used for filtering out suggested phrases (collation).get theconfidence()parameterconfidence(float confidence)Sets the confidence level for this suggester.protected booleandoEquals(PhraseSuggestionBuilder other)Indicates whether some otherSuggestionBuilderof the same type is "equal to" this one.protected intHashCode for the subclass ofSuggestionBuilderto implement.voiddoWriteTo(StreamOutput out)get the setting forforceUnigrams()forceUnigrams(boolean forceUnigrams)If set totruethe phrase suggester will fail if the analyzer only produces ngrams.static PhraseSuggestionBuilderfromXContent(org.elasticsearch.common.xcontent.XContentParser parser)Returns the name of the writeable objectgramSize()get thegramSize(int)parametergramSize(int gramSize)Sets the gram size for the n-gram model used for this suggester.Setup highlighting for suggestions.org.elasticsearch.common.xcontent.XContentBuilderinnerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)get the maxErrors settingmaxErrors(float maxErrors)Sets the maximum percentage of the terms that at most considered to be misspellings in order to form a correction.postTag()get the post-tag for the highlighter set withhighlight(String, String)preTag()get the pre-tag for the highlighter set withhighlight(String, String)get therealWordErrorLikelihood(float)parameterrealWordErrorLikelihood(float realWordErrorLikelihood)Sets the likelihood of a term being a misspelled even if the term exists in the dictionary.get the separator that is used to separate terms in the bigram field.Sets the separator that is used to separate terms in the bigram field.Gets theSmoothingModelsmoothingModel(SmoothingModel model)Sets an explicit smoothing model used for this suggester.get thetokenLimit(int)parametertokenLimit(int tokenLimit)Methods inherited from class org.elasticsearch.search.suggest.SuggestionBuilder
analyzer, analyzer, equals, field, hashCode, populateCommonFields, prefix, prefix, regex, regex, shardSize, shardSize, size, size, text, text, toXContent, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
SUGGESTION_NAME
- See Also:
- Constant Field Values
-
MAXERRORS_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField MAXERRORS_FIELD -
RWE_LIKELIHOOD_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField RWE_LIKELIHOOD_FIELD -
SEPARATOR_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField SEPARATOR_FIELD -
CONFIDENCE_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField CONFIDENCE_FIELD -
GRAMSIZE_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField GRAMSIZE_FIELD -
SMOOTHING_MODEL_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField SMOOTHING_MODEL_FIELD -
FORCE_UNIGRAM_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField FORCE_UNIGRAM_FIELD -
TOKEN_LIMIT_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField TOKEN_LIMIT_FIELD -
HIGHLIGHT_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField HIGHLIGHT_FIELD -
PRE_TAG_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField PRE_TAG_FIELD -
POST_TAG_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField POST_TAG_FIELD -
COLLATE_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField COLLATE_FIELD -
COLLATE_QUERY_FIELD
protected static final org.elasticsearch.common.xcontent.ParseField COLLATE_QUERY_FIELD -
COLLATE_QUERY_PARAMS
protected static final org.elasticsearch.common.xcontent.ParseField COLLATE_QUERY_PARAMS -
COLLATE_QUERY_PRUNE
protected static final org.elasticsearch.common.xcontent.ParseField COLLATE_QUERY_PRUNE
-
-
Constructor Details
-
PhraseSuggestionBuilder
-
PhraseSuggestionBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteToin classSuggestionBuilder<PhraseSuggestionBuilder>- Throws:
IOException
-
gramSize
Sets the gram size for the n-gram model used for this suggester. The default value is1corresponding tounigrams. Use2forbigramsand3fortrigrams. -
gramSize
get thegramSize(int)parameter -
maxErrors
Sets the maximum percentage of the terms that at most considered to be misspellings in order to form a correction. This method accepts a float value in the range [0..1) as a fraction of the actual query terms a number>=1as an absolute number of query terms. The default is set to1.0which corresponds to that only corrections with at most 1 misspelled term are returned. -
maxErrors
get the maxErrors setting -
separator
Sets the separator that is used to separate terms in the bigram field. If not set the whitespace character is used as a separator. -
separator
get the separator that is used to separate terms in the bigram field. -
realWordErrorLikelihood
Sets the likelihood of a term being a misspelled even if the term exists in the dictionary. The default it0.95corresponding to 5% or the real words are misspelled. -
realWordErrorLikelihood
get therealWordErrorLikelihood(float)parameter -
confidence
Sets the confidence level for this suggester. The confidence level defines a factor applied to the input phrases score which is used as a threshold for other suggest candidates. Only candidates that score higher than the threshold will be included in the result. For instance a confidence level of1.0will only return suggestions that score higher than the input phrase. If set to0.0the top N candidates are returned. The default is1.0 -
confidence
get theconfidence()parameter -
addCandidateGenerator
public PhraseSuggestionBuilder addCandidateGenerator(PhraseSuggestionBuilder.CandidateGenerator generator)Adds aPhraseSuggestionBuilder.CandidateGeneratorto this suggester. ThePhraseSuggestionBuilder.CandidateGeneratoris used to draw candidates for each individual phrase term before the candidates are scored. -
clearCandidateGenerators
Clear the candidate generators. -
forceUnigrams
If set totruethe phrase suggester will fail if the analyzer only produces ngrams. the default ittrue. -
forceUnigrams
get the setting forforceUnigrams() -
smoothingModel
Sets an explicit smoothing model used for this suggester. The default isStupidBackoff. -
smoothingModel
Gets theSmoothingModel -
tokenLimit
-
tokenLimit
get thetokenLimit(int)parameter -
highlight
Setup highlighting for suggestions. If this is called a highlight field is returned with suggestions wrapping changed tokens with preTag and postTag. -
preTag
get the pre-tag for the highlighter set withhighlight(String, String) -
postTag
get the post-tag for the highlighter set withhighlight(String, String) -
collateQuery
Sets a query used for filtering out suggested phrases (collation). -
collateQuery
Sets a query used for filtering out suggested phrases (collation). -
collateQuery
gets the query used for filtering out suggested phrases (collation). -
collateParams
Adds additional parameters for collate scripts. Previously added parameters on the same builder will be overwritten. -
collateParams
gets additional params for collate script -
collatePrune
Sets whether to prune suggestions after collation -
collatePrune
Gets whether to prune suggestions after collation -
innerToXContent
public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
innerToXContentin classSuggestionBuilder<PhraseSuggestionBuilder>- Throws:
IOException
-
fromXContent
public static PhraseSuggestionBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
build
public SuggestionSearchContext.SuggestionContext build(SearchExecutionContext context) throws IOException- Specified by:
buildin classSuggestionBuilder<PhraseSuggestionBuilder>- Throws:
IOException
-
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object -
doEquals
Description copied from class:SuggestionBuilderIndicates whether some otherSuggestionBuilderof the same type is "equal to" this one.- Specified by:
doEqualsin classSuggestionBuilder<PhraseSuggestionBuilder>
-
doHashCode
protected int doHashCode()Description copied from class:SuggestionBuilderHashCode for the subclass ofSuggestionBuilderto implement.- Specified by:
doHashCodein classSuggestionBuilder<PhraseSuggestionBuilder>
-