Class Signal

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Signal>

    public class Signal
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Signal>
    See Also:
    Serialized Form
    • Field Detail

      • CLICK

        public static final java.lang.String CLICK
        Signal type for signals generated from a user clicking a search result link
        See Also:
        Constant Field Values
      • RATING

        public static final java.lang.String RATING
        Signal type for signals generated from a user rating a document (e.g. "star" rating)
        See Also:
        Constant Field Values
    • Constructor Detail

      • Signal

        public Signal()
    • Method Detail

      • getSignal

        public static Signal getSignal​(QueryResponse queryResponse,
                                       int documentIndex,
                                       java.lang.String signalType,
                                       double signalStrength,
                                       java.lang.String queryString)
        Create a signal for a given document in the query response. Note that the ordinal in the signal is 1-based so it will be 1 for the document at position 0 (with offset 0) in the results.
        Parameters:
        documentIndex - the index from the offset of the document to associate with the signal
        signalType - the type of the signal (click, rate, screen time)
        signalStrength - the strength of the signal
        queryString - the user's query string, if known
        Returns:
        the new signal
      • getSignal

        public static Signal getSignal​(QueryResponse queryResponse,
                                       int documentIndex,
                                       java.lang.String signalType,
                                       double signalStrength)
        Create a signal for a given document in the query response. Note that the ordinal in the signal is 1-based so it will be 1 for the document at position 0 (with offset 0) in the results. Will try to pull the query string from the query response.
        Parameters:
        queryResponse -
        documentIndex - the index from the offset of the document to associate with the signal
        signalType - the type of the signal (click, rate, screen time)
        signalStrength - the strength of the signal
        Returns:
        the new signal
      • getQueryString

        public static java.lang.String getQueryString​(Query query)
        Get the original query string out of the query... Will recursively check nested queries until it finds the query string or fails to find one (e.g. programmatically created queries won't have this set).
        Parameters:
        query - the query object
        Returns:
      • getSignal

        public static Signal getSignal​(QueryResponse queryResponse,
                                       int documentIndex,
                                       java.lang.String signalType)
        Create a signal with a signal strength of one
        Parameters:
        queryResponse -
        documentIndex - the index from the offset of the document to associate with the signal
        signalType - the type of the signal (click, rate, screen time)
        Returns:
        a signal
      • getSignal

        public static Signal getSignal​(QueryResponse queryResponse,
                                       int documentIndex)
        Create a click signal with a strength of one
        Parameters:
        queryResponse -
        documentIndex - the index from the offset of the document to associate with the signal
        Returns:
        a signal
      • getType

        public java.lang.String getType()
        Get the signal type.
      • setType

        public void setType​(java.lang.String value)
        Set the signal type.
      • getWeight

        public double getWeight()
        Get the weight for the signal.
      • setWeight

        public void setWeight​(double value)
        Set the weight for the signal.
      • isTTL

        public boolean isTTL()
        Get if TTL will be honored for this signal.

        If this is false, then the signal will be persistent and will not be deleted automatically.

      • setTTL

        public void setTTL​(boolean value)
        Get if TTL will be honored for this signal.

        If this is false, then the signal will be persistent and will not be deleted automatically.

      • getRelevancyModelName

        public java.lang.String getRelevancyModelName()
        Get the name for the relevancy model that scored the result associated with this signal.
      • setRelevancyModelName

        public void setRelevancyModelName​(java.lang.String value)
        Set the name for the relevancy model that scored the result associated with this signal.
      • getRelevancyModelVersion

        public long getRelevancyModelVersion()
        Get the version for the relevancy model that scored the result associated with this signal.
      • setRelevancyModelVersion

        public void setRelevancyModelVersion​(long value)
        Set the version for the relevancy model that scored the result associated with this signal.
      • getQueryTimestamp

        public long getQueryTimestamp()
      • setQueryTimestamp

        public void setQueryTimestamp​(long queryTimestamp)
      • getSignalTimestamp

        public long getSignalTimestamp()
      • setSignalTimestamp

        public void setSignalTimestamp​(long signalTimestamp)
      • getDocId

        public java.lang.String getDocId()
      • setDocId

        public void setDocId​(java.lang.String value)
      • getDocOrdinal

        public long getDocOrdinal()
        Get the document ordinal (1-indexed).

        Returns -1 if ordinal is not specified.

      • setDocOrdinal

        public void setDocOrdinal​(long value)
        Set the document ordinal (1-indexed).

        value less than 1 indicates ordinal is not specified.

      • getQuery

        public java.lang.String getQuery()
      • setQuery

        public void setQuery​(java.lang.String value)
      • getLocale

        public java.util.Locale getLocale()
      • setLocale

        public void setLocale​(java.util.Locale locale)
      • getRelevancyModelNames

        public java.lang.String[] getRelevancyModelNames()
      • setRelevancyModelNames

        public void setRelevancyModelNames​(java.lang.String... value)
      • isValid

        @Deprecated
        public boolean isValid()
        Deprecated.
        always returns true
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        protected Signal clone()
                        throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • compareTo

        public int compareTo​(Signal o)
        Specified by:
        compareTo in interface java.lang.Comparable<Signal>