Class RankFeatures

  • All Implemented Interfaces:
    java.lang.Cloneable

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

      Constructors 
      Constructor Description
      RankFeatures()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> asMap()
      Returns the map holding the features of this.
      RankFeatures clone()  
      int encode​(java.nio.ByteBuffer buffer)  
      boolean equals​(java.lang.Object other)  
      java.lang.String get​(java.lang.String name)
      Deprecated.
      use getTensor (or getDouble) instead
      java.util.OptionalDouble getDouble​(java.lang.String name)
      Returns a double rank feature, or empty if there is no value with this name.
      java.lang.Object getObject​(java.lang.String name)
      Returns this value as either a Double, Tensor or String.
      java.util.Optional<com.yahoo.tensor.Tensor> getTensor​(java.lang.String name)
      Returns a rank feature as a tensor, or empty if there is no value with this name.
      int hashCode()  
      boolean isEmpty()  
      void prepare​(RankProperties rankProperties)
      Prepares this for encoding, not for external use.
      void put​(java.lang.String name, double value)
      Sets a double rank feature
      void put​(java.lang.String name, com.yahoo.tensor.Tensor value)
      Sets a tensor rank feature
      void put​(java.lang.String name, java.lang.String value)
      Deprecated.
      set either a double or a tensor
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RankFeatures

        public RankFeatures()
    • Method Detail

      • put

        public void put​(java.lang.String name,
                        double value)
        Sets a double rank feature
      • put

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

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

        @Deprecated
        public java.lang.String get​(java.lang.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 java.lang.Object getObject​(java.lang.String name)
        Returns this value as either a Double, Tensor or String. Returns null if the value is not set.
      • getDouble

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

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

        public java.util.Map<java.lang.String,​java.lang.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​(java.nio.ByteBuffer buffer)
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object