public class TermSuggestionBuilder extends SuggestBuilder.SuggestionBuilder<TermSuggestionBuilder>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor and Description |
---|
TermSuggestionBuilder(String name) |
Modifier and Type | Method and Description |
---|---|
XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
TermSuggestionBuilder |
maxEdits(Integer maxEdits)
Sets the maximum edit distance candidate suggestions can have in order to
be considered as a suggestion.
|
TermSuggestionBuilder |
maxInspections(Integer maxInspections)
A factor that is used to multiply with the size in order to inspect more
candidate suggestions.
|
TermSuggestionBuilder |
maxTermFreq(float maxTermFreq)
Sets a maximum threshold in number of documents a suggest text token can
exist in order to be corrected.
|
TermSuggestionBuilder |
minDocFreq(float minDocFreq)
Sets a minimal threshold in number of documents a suggested term should
appear in.
|
TermSuggestionBuilder |
minWordLength(int minWordLength)
The minimum length a suggest text term must have in order to be
corrected.
|
TermSuggestionBuilder |
prefixLength(int prefixLength)
Sets the number of minimal prefix characters that must match in order be
a candidate suggestion.
|
TermSuggestionBuilder |
setAccuracy(float accuracy)
s how similar the suggested terms at least need to be compared to the
original suggest text tokens.
|
TermSuggestionBuilder |
sort(String sort)
Sets how to sort the suggest terms per suggest text token.
|
TermSuggestionBuilder |
stringDistance(String stringDistance)
Sets what string distance implementation to use for comparing how similar
suggested terms are.
|
TermSuggestionBuilder |
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.
|
addCategory, addCategory, addContextField, addContextField, addGeoLocation, addGeoLocation, addGeoLocationWithPrecision, analyzer, field, shardSize, size, text, toXContent
buildAsBytes, buildAsBytes, toString
public TermSuggestionBuilder(String name)
name
- The name of this suggestion. This is a required parameter.public TermSuggestionBuilder suggestMode(String suggestMode)
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.
public TermSuggestionBuilder setAccuracy(float accuracy)
Default is 0.5
public TermSuggestionBuilder sort(String sort)
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 scotr and then the term itself.
What the score is depends on the suggester being used.
public TermSuggestionBuilder stringDistance(String stringDistance)
internal
- This is the default and is based on
damerau_levenshtein
, but highly optimized for comparing
string distance for terms inside the index.
damerau_levenshtein
- String distance algorithm based on
Damerau-Levenshtein algorithm.
levenstein
- String distance algorithm based on
Levenstein edit distance algorithm.
jarowinkler
- String distance algorithm based on
Jaro-Winkler algorithm.
ngram
- String distance algorithm based on character
n-grams.
public TermSuggestionBuilder maxEdits(Integer maxEdits)
public TermSuggestionBuilder maxInspections(Integer maxInspections)
public TermSuggestionBuilder maxTermFreq(float maxTermFreq)
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.
public TermSuggestionBuilder prefixLength(int prefixLength)
public TermSuggestionBuilder minWordLength(int minWordLength)
public TermSuggestionBuilder minDocFreq(float minDocFreq)
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
innerToXContent
in class SuggestBuilder.SuggestionBuilder<TermSuggestionBuilder>
IOException
Copyright © 2009–2017. All rights reserved.