Class DirectCandidateGeneratorBuilder
java.lang.Object
org.elasticsearch.search.suggest.phrase.DirectCandidateGeneratorBuilder
- All Implemented Interfaces:
Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentObject
,PhraseSuggestionBuilder.CandidateGenerator
public final class DirectCandidateGeneratorBuilder
extends Object
implements PhraseSuggestionBuilder.CandidateGenerator
-
Nested Class Summary
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.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ConstructingObjectParser<DirectCandidateGeneratorBuilder,Void>
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionRead from a stream. -
Method Summary
Modifier and TypeMethodDescriptionaccuracy(float accuracy)
Sets how similar the suggested terms at least need to be compared to the original suggest text tokens.org.elasticsearch.search.suggest.phrase.PhraseSuggestionContext.DirectCandidateGenerator
build(IndexAnalyzers indexAnalyzers)
boolean
getType()
gets the type identifier of thisPhraseSuggestionBuilder.CandidateGenerator
int
hashCode()
Sets the maximum edit distance candidate suggestions can have in order to be considered as a suggestion.maxInspections(Integer maxInspections)
A factor that is used to multiply with the size in order to inspect more candidate suggestions.maxTermFreq(float maxTermFreq)
Sets a maximum threshold in number of documents a suggest text token can exist in order to be corrected.minDocFreq(float minDocFreq)
Sets a minimal threshold in number of documents a suggested term should appear in.minWordLength(int minWordLength)
The minimum length a suggest text term must have in order to be corrected.postFilter(String postFilter)
Sets a filter (analyzer) that is applied to each of the generated tokens before they are passed to the actual phrase scorer.Sets a filter (analyzer) that is applied to each of the tokens passed to this candidate generator.prefixLength(int prefixLength)
Sets the number of minimal prefix characters that must match in order be a candidate suggestion.size(int size)
Sets the maximum suggestions to be returned per suggest text term.Sets how to sort the suggest terms per suggest text token.stringDistance(String stringDistance)
Sets what string distance implementation to use for comparing how similar suggested terms are.suggestMode(String suggestMode)
The global suggest mode controls what suggested terms are included or controls for what suggest text tokens, terms should be suggested for.toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
DIRECT_GENERATOR_FIELD
public static final org.elasticsearch.common.xcontent.ParseField DIRECT_GENERATOR_FIELD -
FIELDNAME_FIELD
public static final org.elasticsearch.common.xcontent.ParseField FIELDNAME_FIELD -
PREFILTER_FIELD
public static final org.elasticsearch.common.xcontent.ParseField PREFILTER_FIELD -
POSTFILTER_FIELD
public static final org.elasticsearch.common.xcontent.ParseField POSTFILTER_FIELD -
SUGGESTMODE_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SUGGESTMODE_FIELD -
MIN_DOC_FREQ_FIELD
public static final org.elasticsearch.common.xcontent.ParseField MIN_DOC_FREQ_FIELD -
ACCURACY_FIELD
public static final org.elasticsearch.common.xcontent.ParseField ACCURACY_FIELD -
SIZE_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SIZE_FIELD -
SORT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SORT_FIELD -
STRING_DISTANCE_FIELD
public static final org.elasticsearch.common.xcontent.ParseField STRING_DISTANCE_FIELD -
MAX_EDITS_FIELD
public static final org.elasticsearch.common.xcontent.ParseField MAX_EDITS_FIELD -
MAX_INSPECTIONS_FIELD
public static final org.elasticsearch.common.xcontent.ParseField MAX_INSPECTIONS_FIELD -
MAX_TERM_FREQ_FIELD
public static final org.elasticsearch.common.xcontent.ParseField MAX_TERM_FREQ_FIELD -
PREFIX_LENGTH_FIELD
public static final org.elasticsearch.common.xcontent.ParseField PREFIX_LENGTH_FIELD -
MIN_WORD_LENGTH_FIELD
public static final org.elasticsearch.common.xcontent.ParseField MIN_WORD_LENGTH_FIELD -
PARSER
public static final org.elasticsearch.common.xcontent.ConstructingObjectParser<DirectCandidateGeneratorBuilder,Void> PARSER
-
-
Constructor Details
-
DirectCandidateGeneratorBuilder
- Parameters:
field
- Sets from what field to fetch the candidate suggestions from.
-
DirectCandidateGeneratorBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
suggestMode
The global suggest mode controls what suggested terms are included or controls for what suggest text tokens, terms should be suggested for. Three possible values can be specified:missing
- Only suggest terms in the suggest text that aren't in the index. This is the default.popular
- Only suggest terms that occur in more docs then the original suggest text term.always
- Suggest any matching suggest terms based on tokens in the suggest text.
-
accuracy
Sets how similar the suggested terms at least need to be compared to the original suggest text tokens. A value between 0 and 1 can be specified. This value will be compared to the string distance result of each candidate spelling correction.Default is
0.5
-
size
Sets the maximum suggestions to be returned per suggest text term. -
sort
Sets how to sort the suggest terms per suggest text token. Two possible values:score
- Sort should first be based on score, then document frequency and then the term itself.frequency
- Sort should first be based on document frequency, then score and then the term itself.
What the score is depends on the suggester being used.
-
stringDistance
Sets what string distance implementation to use for comparing how similar suggested terms are. Four possible values can be specified:internal
- This is the default and is based ondamerau_levenshtein
, but highly optimized for comparing string distance for terms inside the index.damerau_levenshtein
- String distance algorithm based on Damerau-Levenshtein algorithm.levenshtein
- String distance algorithm based on Levenshtein edit distance algorithm.jaro_winkler
- String distance algorithm based on Jaro-Winkler algorithm.ngram
- String distance algorithm based on character n-grams.
-
maxEdits
Sets the maximum edit distance candidate suggestions can have in order to be considered as a suggestion. Can only be a value between 1 and 2. Any other value result in an bad request error being thrown. Defaults to2
. -
maxInspections
A factor that is used to multiply with the size in order to inspect more candidate suggestions. Can improve accuracy at the cost of performance. Defaults to5
. -
maxTermFreq
Sets a maximum threshold in number of documents a suggest text token can exist in order to be corrected. Can be a relative percentage number (e.g 0.4) or an absolute number to represent document frequencies. If an value higher than 1 is specified then fractional can not be specified. Defaults to0.01
.This can be used to exclude high frequency terms from being suggested. High frequency terms are usually spelled correctly on top of this this also improves the suggest performance.
-
prefixLength
Sets the number of minimal prefix characters that must match in order be a candidate suggestion. Defaults to 1. Increasing this number improves suggest performance. Usually misspellings don't occur in the beginning of terms. -
minWordLength
The minimum length a suggest text term must have in order to be corrected. Defaults to4
. -
minDocFreq
Sets a minimal threshold in number of documents a suggested term should appear in. This can be specified as an absolute number or as a relative percentage of number of documents. This can improve quality by only suggesting high frequency terms. Defaults to 0f and is not enabled. If a value higher than 1 is specified then the number cannot be fractional. -
preFilter
Sets a filter (analyzer) that is applied to each of the tokens passed to this candidate generator. This filter is applied to the original token before candidates are generated. -
postFilter
Sets a filter (analyzer) that is applied to each of the generated tokens before they are passed to the actual phrase scorer. -
getType
gets the type identifier of thisPhraseSuggestionBuilder.CandidateGenerator
- Specified by:
getType
in interfacePhraseSuggestionBuilder.CandidateGenerator
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
build
public org.elasticsearch.search.suggest.phrase.PhraseSuggestionContext.DirectCandidateGenerator build(IndexAnalyzers indexAnalyzers)- Specified by:
build
in interfacePhraseSuggestionBuilder.CandidateGenerator
-
toString
-
hashCode
public int hashCode() -
equals
-