Class StoredLtrQueryBuilder

java.lang.Object
org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
org.codelibs.fess.opensearch.query.StoredLtrQueryBuilder
All Implemented Interfaces:
org.opensearch.core.common.io.stream.NamedWriteable, org.opensearch.core.common.io.stream.Writeable, org.opensearch.core.xcontent.ToXContent, org.opensearch.core.xcontent.ToXContentObject, org.opensearch.index.query.QueryBuilder, org.opensearch.index.query.Rewriteable<org.opensearch.index.query.QueryBuilder>

public class StoredLtrQueryBuilder extends org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder> implements org.opensearch.core.common.io.stream.NamedWriteable
A query builder for a stored LTR (Learning to Rank) query. This builder constructs a query that uses a pre-trained LTR model to re-rank search results based on a given set of features.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent

    org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable

    org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.opensearch.core.ParseField
    The parse field for the active features.
    static final org.opensearch.core.ParseField
    The parse field for the featureset name.
    static final org.opensearch.core.ParseField
    The parse field for the model name.
    static final String
    The name of the query.
    static final org.opensearch.core.ParseField
    The parse field for the query parameters.
    static final org.opensearch.core.ParseField
    The parse field for the store name.

    Fields inherited from class org.opensearch.index.query.AbstractQueryBuilder

    boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName

    Fields inherited from interface org.opensearch.index.query.Rewriteable

    MAX_REWRITE_ROUNDS

    Fields inherited from interface org.opensearch.core.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new stored LTR query builder.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the list of active features.
    activeFeatures(List<String> activeFeatures)
    Sets the list of active features.
    protected boolean
     
    protected int
     
    protected org.apache.lucene.search.Query
    doToQuery(org.opensearch.index.query.QueryShardContext context)
     
    protected void
    doWriteTo(org.opensearch.core.common.io.stream.StreamOutput out)
     
    protected void
    doXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params)
     
    Gets the name of the featureset.
    featureSetName(String featureSetName)
    Sets the name of the featureset.
     
    Gets the name of the LTR model.
    modelName(String modelName)
    Sets the name of the LTR model.
    Gets the parameters for the LTR query.
    Sets the parameters for the LTR query.
    Gets the name of the feature store.
    storeName(String storeName)
    Sets the name of the feature store.

    Methods inherited from class org.opensearch.index.query.AbstractQueryBuilder

    addValidationError, boost, boost, checkNegativeBoost, declareStandardFields, doRewrite, equals, extractInnerHitBuilders, filter, getName, hashCode, maybeConvertToBytesRef, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, validateFilterParams, writeTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opensearch.index.query.QueryBuilder

    supportsIntraSegmentSearch, visit

    Methods inherited from interface org.opensearch.core.xcontent.ToXContentObject

    isFragment

    Methods inherited from interface org.opensearch.core.common.io.stream.Writeable

    writeTo
  • Field Details

    • NAME

      public static final String NAME
      The name of the query.
      See Also:
    • MODEL_NAME

      public static final org.opensearch.core.ParseField MODEL_NAME
      The parse field for the model name.
    • FEATURESET_NAME

      public static final org.opensearch.core.ParseField FEATURESET_NAME
      The parse field for the featureset name.
    • STORE_NAME

      public static final org.opensearch.core.ParseField STORE_NAME
      The parse field for the store name.
    • PARAMS

      public static final org.opensearch.core.ParseField PARAMS
      The parse field for the query parameters.
    • ACTIVE_FEATURES

      public static final org.opensearch.core.ParseField ACTIVE_FEATURES
      The parse field for the active features.
  • Constructor Details

    • StoredLtrQueryBuilder

      public StoredLtrQueryBuilder()
      Constructs a new stored LTR query builder.
  • Method Details

    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface org.opensearch.core.common.io.stream.NamedWriteable
    • doWriteTo

      protected void doWriteTo(org.opensearch.core.common.io.stream.StreamOutput out) throws IOException
      Specified by:
      doWriteTo in class org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
      Throws:
      IOException
    • doXContent

      protected void doXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      doXContent in class org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
      Throws:
      IOException
    • doToQuery

      protected org.apache.lucene.search.Query doToQuery(org.opensearch.index.query.QueryShardContext context) throws IOException
      Specified by:
      doToQuery in class org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
      Throws:
      IOException
    • doEquals

      protected boolean doEquals(StoredLtrQueryBuilder other)
      Specified by:
      doEquals in class org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
    • doHashCode

      protected int doHashCode()
      Specified by:
      doHashCode in class org.opensearch.index.query.AbstractQueryBuilder<StoredLtrQueryBuilder>
    • modelName

      public String modelName()
      Gets the name of the LTR model.
      Returns:
      The model name.
    • modelName

      public StoredLtrQueryBuilder modelName(String modelName)
      Sets the name of the LTR model.
      Parameters:
      modelName - The model name.
      Returns:
      This query builder.
    • featureSetName

      public String featureSetName()
      Gets the name of the featureset.
      Returns:
      The featureset name.
    • featureSetName

      public StoredLtrQueryBuilder featureSetName(String featureSetName)
      Sets the name of the featureset.
      Parameters:
      featureSetName - The featureset name.
      Returns:
      This query builder.
    • storeName

      public String storeName()
      Gets the name of the feature store.
      Returns:
      The store name.
    • storeName

      public StoredLtrQueryBuilder storeName(String storeName)
      Sets the name of the feature store.
      Parameters:
      storeName - The store name.
      Returns:
      This query builder.
    • params

      public Map<String,Object> params()
      Gets the parameters for the LTR query.
      Returns:
      A map of query parameters.
    • params

      public StoredLtrQueryBuilder params(Map<String,Object> params)
      Sets the parameters for the LTR query.
      Parameters:
      params - A map of query parameters.
      Returns:
      This query builder.
    • activeFeatures

      public List<String> activeFeatures()
      Gets the list of active features.
      Returns:
      A list of active features.
    • activeFeatures

      public StoredLtrQueryBuilder activeFeatures(List<String> activeFeatures)
      Sets the list of active features.
      Parameters:
      activeFeatures - A list of active features.
      Returns:
      This query builder.