Class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option>

java.lang.Object
org.elasticsearch.search.suggest.Suggest.Suggestion.Entry<O>
All Implemented Interfaces:
Iterable<O>, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment
Direct Known Subclasses:
CompletionSuggestion.Entry, PhraseSuggestion.Entry, TermSuggestion.Entry
Enclosing class:
Suggest.Suggestion<T extends Suggest.Suggestion.Entry>

public abstract static class Suggest.Suggestion.Entry<O extends Suggest.Suggestion.Entry.Option> extends Object implements Iterable<O>, Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
Represents a part from the suggest text with suggested options.
  • Field Details

  • Constructor Details

  • Method Details

    • addOption

      public void addOption(O option)
    • addOptions

      protected void addOptions(List<O> options)
    • sort

      protected void sort(Comparator<O> comparator)
    • reduce

      protected <T extends Suggest.Suggestion.Entry<O>> Suggest.Suggestion.Entry<O> reduce(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 Iterator<O> iterator()
      Specified by:
      iterator in interface Iterable<O extends Suggest.Suggestion.Entry.Option>
    • getOptions

      public 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • newOption

      protected abstract O newOption(StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • declareCommonFields

      protected static void declareCommonFields(org.elasticsearch.common.xcontent.ObjectParser<? extends Suggest.Suggestion.Entry<? extends Suggest.Suggestion.Entry.Option>,Void> parser)