Record Class QueryExtractorBuilder

java.lang.Object
java.lang.Record
org.elasticsearch.xpack.core.ml.inference.trainedmodel.ltr.QueryExtractorBuilder
All Implemented Interfaces:
NamedWriteable, Writeable, Rewriteable<LearningToRankFeatureExtractorBuilder>, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject, LearningToRankFeatureExtractorBuilder, NamedXContentObject

public record QueryExtractorBuilder(String featureName, QueryProvider query, float defaultScore) extends Record implements LearningToRankFeatureExtractorBuilder
  • Field Details

    • NAME

      public static final org.elasticsearch.xcontent.ParseField NAME
    • FEATURE_NAME

      public static final org.elasticsearch.xcontent.ParseField FEATURE_NAME
    • QUERY

      public static final org.elasticsearch.xcontent.ParseField QUERY
    • DEFAULT_SCORE

      public static final org.elasticsearch.xcontent.ParseField DEFAULT_SCORE
    • DEFAULT_SCORE_DEFAULT

      public static float DEFAULT_SCORE_DEFAULT
  • Constructor Details

    • QueryExtractorBuilder

      public QueryExtractorBuilder(String featureName, QueryProvider query)
    • QueryExtractorBuilder

      public QueryExtractorBuilder(String featureName, QueryProvider query, float defaultScore)
      Creates an instance of a QueryExtractorBuilder record class.
      Parameters:
      featureName - the value for the featureName record component
      query - the value for the query record component
      defaultScore - the value for the defaultScore record component
    • QueryExtractorBuilder

      public QueryExtractorBuilder(StreamInput input) throws IOException
      Throws:
      IOException
  • Method Details

    • fromXContent

      public static QueryExtractorBuilder fromXContent(org.elasticsearch.xcontent.XContentParser parser, Object context)
    • toXContent

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

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • featureName

      public String featureName()
      Returns the value of the featureName record component.
      Specified by:
      featureName in interface LearningToRankFeatureExtractorBuilder
      Returns:
      the value of the featureName record component
    • validate

      public void validate() throws Exception
      Specified by:
      validate in interface LearningToRankFeatureExtractorBuilder
      Throws:
      Exception - If the extractor is invalid.
    • getName

      public String getName()
      Specified by:
      getName in interface NamedXContentObject
      Returns:
      The name of the XContentObject that is to be serialized
    • rewrite

      Specified by:
      rewrite in interface Rewriteable<LearningToRankFeatureExtractorBuilder>
      Throws:
      IOException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • query

      public QueryProvider query()
      Returns the value of the query record component.
      Returns:
      the value of the query record component
    • defaultScore

      public float defaultScore()
      Returns the value of the defaultScore record component.
      Returns:
      the value of the defaultScore record component