Class RankFeatures

java.lang.Object
com.yahoo.search.query.ranking.RankFeatures
All Implemented Interfaces:
Cloneable

public class RankFeatures extends Object implements Cloneable
Contains the rank features of a query.
Author:
bratseth
  • Constructor Details

    • RankFeatures

      public RankFeatures()
  • Method Details

    • put

      public void put(String name, double value)
      Sets a double rank feature
    • put

      public void put(String name, com.yahoo.tensor.Tensor value)
      Sets a tensor rank feature
    • put

      @Deprecated public void put(String name, String value)
      Deprecated.
      set either a double or a tensor
      Sets a rank feature to a value represented as a string.
    • get

      @Deprecated public String get(String name)
      Deprecated.
      use getTensor (or getDouble) instead
      Returns a rank feature as a string by full name or null if not set
    • getObject

      public Object getObject(String name)
      Returns this value as either a Double, Tensor or String. Returns null if the value is not set.
    • getDouble

      public OptionalDouble getDouble(String name)
      Returns a double rank feature, or empty if there is no value with this name.
      Throws:
      IllegalArgumentException - if the value is set but is not a double
    • getTensor

      public Optional<com.yahoo.tensor.Tensor> getTensor(String name)
      Returns a rank feature as a tensor, or empty if there is no value with this name.
      Throws:
      IllegalArgumentException - if the value is a string, not a tensor or double
    • asMap

      public Map<String,Object> asMap()
      Returns the map holding the features of this. This map may be modified to change the rank features of the query.
    • isEmpty

      public boolean isEmpty()
    • prepare

      public void prepare(RankProperties rankProperties)
      Prepares this for encoding, not for external use. See encode on Query for details.

      If the query feature is found in the rank feature set, remove all these entries and insert them into the rank property set instead. We want to hide from the user that the query feature value is sent down as a rank property and picked up by the query feature executor in the backend.

    • encode

      public int encode(ByteBuffer buffer)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

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

      public RankFeatures clone()
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object