Package org.elasticsearch.search.suggest
Class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option>
- java.lang.Object
-
- org.elasticsearch.search.suggest.Suggest.Suggestion.Entry<O>
-
- All Implemented Interfaces:
java.lang.Iterable<O>,Streamable,ToXContent,ToXContentObject
- Direct Known Subclasses:
CompletionSuggestion.Entry,PhraseSuggestion.Entry,TermSuggestion.Entry
- Enclosing class:
- Suggest.Suggestion<T extends Suggest.Suggestion.Entry>
public static class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option> extends java.lang.Object implements java.lang.Iterable<O>, Streamable, ToXContentObject
Represents a part from the suggest text with suggested options.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSuggest.Suggestion.Entry.OptionContains the suggested text with its document frequency and score.-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
Fields Modifier and Type Field Description protected intlengthprotected intoffsetprotected java.util.List<O>optionsprotected static java.lang.StringOPTIONSprotected Texttext-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Method Summary
Modifier and Type Method Description voidaddOption(O option)protected voidaddOptions(java.util.List<O> options)protected static voiddeclareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,java.lang.Void> parser)booleanequals(java.lang.Object o)static Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>fromXContent(XContentParser parser)intgetLength()intgetOffset()java.util.List<O>getOptions()TextgetText()inthashCode()java.util.Iterator<O>iterator()protected voidmerge(Suggest.Suggestion.Entry<O> other)Merge any extra fields for this subtype.protected OnewOption()voidreadFrom(StreamInput in)Set this object's fields from a StreamInput.protected <T extends Suggest.Suggestion.Entry<O>>
Suggest.Suggestion.Entry<O>reduce(java.util.List<T> toReduce)protected voidsort(java.util.Comparator<O> comparator)XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this object's fields to a StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
OPTIONS
protected static final java.lang.String OPTIONS
- See Also:
- Constant Field Values
-
text
protected Text text
-
offset
protected int offset
-
length
protected int length
-
options
protected java.util.List<O extends Suggest.Suggestion.Entry.Option> options
-
-
Constructor Detail
-
Entry
public Entry(Text text, int offset, int length)
-
Entry
protected Entry()
-
-
Method Detail
-
addOption
public void addOption(O option)
-
addOptions
protected void addOptions(java.util.List<O> options)
-
sort
protected void sort(java.util.Comparator<O> comparator)
-
reduce
protected <T extends Suggest.Suggestion.Entry<O>> Suggest.Suggestion.Entry<O> reduce(java.util.List<T> toReduce)
-
merge
protected void merge(Suggest.Suggestion.Entry<O> other)
Merge any extra fields for this subtype.
-
getText
public Text getText()
- Returns:
- the text (analyzed by suggest analyzer) originating from the suggest text. Usually this is a single term.
-
getOffset
public int getOffset()
- Returns:
- the start offset (not analyzed) for this entry in the suggest text.
-
getLength
public int getLength()
- Returns:
- the length (not analyzed) for this entry in the suggest text.
-
iterator
public java.util.Iterator<O> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<O extends Suggest.Suggestion.Entry.Option>
-
getOptions
public java.util.List<O> getOptions()
- Returns:
- The suggested options for this particular suggest entry. If there are no suggested terms then an empty list is returned.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:StreamableSet this object's fields from a StreamInput.- Specified by:
readFromin interfaceStreamable- Throws:
java.io.IOException
-
newOption
protected O newOption()
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:StreamableWrite this object's fields to a StreamOutput.- Specified by:
writeToin interfaceStreamable- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
declareCommonFields
protected static void declareCommonFields(ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,java.lang.Void> parser)
-
fromXContent
public static Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option> fromXContent(XContentParser parser)
-
-