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(Ranking parent)
  • 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

      public void put(String name, String value)
      Sets a rank feature to a string. This will be available as the hash value of the string in ranking, so it can be used in equality comparisons with other string, but not for any other purpose.
    • 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
    • getString

      public Optional<String> getString(String name)
      Returns a rank feature as a string, or empty if there is no value with this name.
      Throws:
      IllegalArgumentException - if the value is a tensor or double, not a string
    • 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
    • cloneFor

      public RankFeatures cloneFor(Ranking parent)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isFeatureName

      public static boolean isFeatureName(String fullPropertyName)