Module org.elasticsearch.server
Class CompletionSuggestion
java.lang.Object
org.elasticsearch.search.suggest.Suggest.Suggestion<CompletionSuggestion.Entry>
org.elasticsearch.search.suggest.completion.CompletionSuggestion
- All Implemented Interfaces:
Iterable<CompletionSuggestion.Entry>,NamedWriteable,Writeable,ToXContent,ToXContentFragment
Suggestion response for
CompletionSuggester results
Response format for each entry:
{
"text" : STRING
"score" : FLOAT
"contexts" : CONTEXTS
}
CONTEXTS : {
"CONTEXT_NAME" : ARRAY,
..
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
entries, name, sizeFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionCompletionSuggestion(String name, int size, boolean skipDuplicates) Creates a completion suggestion given its name, size and whether it should skip duplicates -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the name of the writeable objectinthashCode()booleanprotected CompletionSuggestion.EntrynewEntry(StreamInput in) reduce(List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce) Merges the result of another suggestion into this suggestion.voidsetShardIndex(int shardIndex) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
addTerm, getEntries, getName, getSize, iterator, sortComparator, toXContent, trimMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
CompletionSuggestion
Creates a completion suggestion given its name, size and whether it should skip duplicates- Parameters:
name- The name for the suggestionssize- The number of suggestions to returnskipDuplicates- Whether duplicate suggestions should be filtered out
-
CompletionSuggestion
- Throws:
IOException
-
-
Method Details
-
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classSuggest.Suggestion<CompletionSuggestion.Entry>- Throws:
IOException
-
getOptions
- Returns:
- the result options for the suggestion
-
hasScoreDocs
public boolean hasScoreDocs()- Returns:
- whether there is any hits for the suggestion
-
equals
- Overrides:
equalsin classSuggest.Suggestion<CompletionSuggestion.Entry>
-
hashCode
public int hashCode()- Overrides:
hashCodein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
reduce
Description copied from class:Suggest.SuggestionMerges the result of another suggestion into this suggestion. For internal usage.- Overrides:
reducein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
setShardIndex
public void setShardIndex(int shardIndex) -
newEntry
- Specified by:
newEntryin classSuggest.Suggestion<CompletionSuggestion.Entry>- Throws:
IOException
-