Class CustomSuggestion
java.lang.Object
org.opensearch.search.suggest.Suggest.Suggestion<CustomSuggestion.Entry>
org.opensearch.example.customsuggester.CustomSuggestion
- All Implemented Interfaces:
java.lang.Iterable<CustomSuggestion.Entry>,NamedWriteable,Writeable,ToXContent,ToXContentFragment
public class CustomSuggestion extends Suggest.Suggestion<CustomSuggestion.Entry>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCustomSuggestion.EntryNested classes/interfaces inherited from interface org.opensearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.common.io.stream.Writeable
Writeable.Reader<V extends java.lang.Object>, Writeable.Writer<V extends java.lang.Object> -
Field Summary
Fields Modifier and Type Field Description static ParseFieldDUMMYstatic intTYPE -
Constructor Summary
Constructors Constructor Description CustomSuggestion(java.lang.String name, int size, java.lang.String dummy)CustomSuggestion(StreamInput in) -
Method Summary
Modifier and Type Method Description static CustomSuggestionfromXContent(XContentParser parser, java.lang.String name)java.lang.StringgetDummy()A meaningless value used to test that plugin suggesters can add fields to their Suggestion types This can't be serialized to xcontent because Suggestions appear in xcontent as an array of entries, so there is no place to add a custom field.java.lang.StringgetWriteableName()intgetWriteableType()protected CustomSuggestion.EntrynewEntry(StreamInput in)voidwriteTo(StreamOutput out)Methods inherited from class org.opensearch.search.suggest.Suggest.Suggestion
addTerm, equals, fromXContent, getEntries, getName, getSize, hashCode, iterator, parseEntries, reduce, sortComparator, toXContent, trim
-
Field Details
-
TYPE
public static final int TYPE- See Also:
- Constant Field Values
-
DUMMY
-
-
Constructor Details
-
CustomSuggestion
public CustomSuggestion(java.lang.String name, int size, java.lang.String dummy) -
CustomSuggestion
- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classSuggest.Suggestion<CustomSuggestion.Entry>- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein classSuggest.Suggestion<CustomSuggestion.Entry>
-
getWriteableType
public int getWriteableType()- Overrides:
getWriteableTypein classSuggest.Suggestion<CustomSuggestion.Entry>
-
getDummy
public java.lang.String getDummy()A meaningless value used to test that plugin suggesters can add fields to their Suggestion types This can't be serialized to xcontent because Suggestions appear in xcontent as an array of entries, so there is no place to add a custom field. But we can still use a custom field internally and use it to define a Suggestion's behavior -
newEntry
- Specified by:
newEntryin classSuggest.Suggestion<CustomSuggestion.Entry>- Throws:
java.io.IOException
-
fromXContent
public static CustomSuggestion fromXContent(XContentParser parser, java.lang.String name) throws java.io.IOException- Throws:
java.io.IOException
-