Class RankFeatures

  • All Implemented Interfaces:
    Cloneable

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

      • RankFeatures

        public RankFeatures()
    • Method Detail

      • 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.
      • 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)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object