Class PhraseSuggester
The phrase suggester adds additional logic on top of the term suggester to select entire corrected phrases instead of
individual tokens weighted based on ngram-language models. In practice this suggester will be able to make better decisions
about which tokens to pick based on co-occurrence and frequencies.
Inheritance
PhraseSuggester
Assembly: OpenSearch.Client.dll
Syntax
public class PhraseSuggester : SuggesterBase, IPhraseSuggester, ISuggester
Properties
|
Edit this page
View Source
Collate
Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index.
The collate query for a suggestion is run only on the local shard from which the suggestion has been generated from.
The query must be specified and can be templated. The current suggestion is automatically made available as
the {{suggestion}} variable, which should be used in your query. You can still specify your own template params ,
the suggestion value will be added to the variables you specify.
Additionally, you can specify a prune to control if all phrase suggestions will be returned; when set to true the
suggestions will have an additional option collate_match, which will be true if matching documents for the phrase was found,
false otherwise. The default value for prune is false.
Declaration
public IPhraseSuggestCollate Collate { get; set; }
Property Value
|
Edit this page
View Source
Confidence
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 of 1.0 will only return suggestions that score higher than the input phrase.
If set to 0.0 the top N candidates are returned. The default is 1.0.
Declaration
public double? Confidence { get; set; }
Property Value
|
Edit this page
View Source
DirectGenerator
Candidate generators used to produce a list of possible terms per term in the given text.
A single candidate generator is similar to a term suggester called for each individual term in the text.
The output of the generators is subsequently scored in combination with the candidates from the other terms for suggestion candidates.
Each of the generators is called per term in the original text.
Declaration
public IEnumerable<IDirectGenerator> DirectGenerator { get; set; }
Property Value
|
Edit this page
View Source
ForceUnigrams
Declaration
public bool? ForceUnigrams { get; set; }
Property Value
|
Edit this page
View Source
GramSize
Sets max size of the n-grams (shingles) in the field. If the field doesn’t contain n-grams (shingles), this should be omitted or set to 1.
Note that OpenSearch tries to detect the gram size based on the specified field. If the field uses a shingle filter,
the gram_size is set to the max_shingle_size if not explicitly set.
Declaration
public int? GramSize { get; set; }
Property Value
|
Edit this page
View Source
Highlight
Sets up suggestion highlighting. If not provided then no highlighted field is returned.
If provided must contain exactly pre_tag and post_tag, which are wrapped around the changed tokens.
If multiple tokens in a row are changed the entire phrase of changed tokens is wrapped rather than each token.
Declaration
public IPhraseSuggestHighlight Highlight { get; set; }
Property Value
|
Edit this page
View Source
MaxErrors
The maximum percentage of the terms 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 or a number >=1 as an absolute number
of query terms. The default is set to 1.0, meaning only corrections with at most one misspelled term are returned.
Note that setting this too high can negatively impact performance. Low values like 1 or 2 are recommended; otherwise the time spend
in suggest calls might exceed the time spend in query execution.
Declaration
public double? MaxErrors { get; set; }
Property Value
|
Edit this page
View Source
RealWordErrorLikelihood
The likelihood of a term being a misspelled even if the term exists in the dictionary.
The default is 0.95, meaning 5% of the real words are misspelled.
Declaration
public double? RealWordErrorLikelihood { get; set; }
Property Value
|
Edit this page
View Source
Separator
The separator that is used to separate terms in the bigram field.
If not set the whitespace character is used as a separator.
Declaration
public char? Separator { get; set; }
Property Value
|
Edit this page
View Source
ShardSize
Sets the maximum number of suggested terms to be retrieved from each individual shard.
During the reduce phase, only the top N suggestions are returned based on the size option. Defaults to 5.
Declaration
public int? ShardSize { get; set; }
Property Value
|
Edit this page
View Source
Smoothing
Smoothing model to balance weight between infrequent grams (grams (shingles) are not existing in the index)
and frequent grams (appear at least once in the index).
Declaration
public SmoothingModelContainer Smoothing { get; set; }
Property Value
|
Edit this page
View Source
Text
Sets the text / query to provide suggestions for.
Declaration
public string Text { get; set; }
Property Value
|
Edit this page
View Source
TokenLimit
Declaration
public int? TokenLimit { get; set; }
Property Value
Implements
Extension Methods