Package com.attivio.sdk.search.relevancy
Class Signal
- java.lang.Object
-
- com.attivio.sdk.search.relevancy.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSignal.SimpleSignalCompareCompares using type, query, docId, and principal.
-
Constructor Summary
Constructors Constructor Description Signal()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Signalclone()intcompareTo(Signal o)booleanequals(java.lang.Object obj)java.lang.StringgetDocId()longgetDocOrdinal()Get the document ordinal (1-indexed).RelevancyFeatureVectorgetFeatureVector()java.util.LocalegetLocale()AttivioPrincipalgetPrincipal()java.lang.StringgetQuery()static java.lang.StringgetQueryString(Query query)Get the original query string out of the query...longgetQueryTimestamp()java.lang.StringgetRelevancyModelName()Get the name for the relevancy model that scored the result associated with this signal.java.lang.String[]getRelevancyModelNames()longgetRelevancyModelVersion()Get the version for the relevancy model that scored the result associated with this signal.static SignalgetSignal(QueryResponse queryResponse, int documentIndex)Create a click signal with a strength of onestatic SignalgetSignal(QueryResponse queryResponse, int documentIndex, java.lang.String signalType)Create a signal with a signal strength of onestatic SignalgetSignal(QueryResponse queryResponse, int documentIndex, java.lang.String signalType, double signalStrength)Create a signal for a given document in the query response.static SignalgetSignal(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.longgetSignalTimestamp()java.lang.StringgetType()Get the signal type.doublegetWeight()Get the weight for the signal.inthashCode()booleanisTTL()Get if TTL will be honored for this signal.booleanisValid()Deprecated.always returns truevoidsetDocId(java.lang.String value)voidsetDocOrdinal(long value)Set the document ordinal (1-indexed).voidsetFeatureVector(RelevancyFeatureVector featureVector)voidsetLocale(java.util.Locale locale)voidsetPrincipal(AttivioPrincipal principal)voidsetQuery(java.lang.String value)voidsetQueryTimestamp(long queryTimestamp)voidsetRelevancyModelName(java.lang.String value)Set the name for the relevancy model that scored the result associated with this signal.voidsetRelevancyModelNames(java.lang.String... value)voidsetRelevancyModelVersion(long value)Set the version for the relevancy model that scored the result associated with this signal.voidsetSignalTimestamp(long signalTimestamp)voidsetTTL(boolean value)Get if TTL will be honored for this signal.voidsetType(java.lang.String value)Set the signal type.voidsetWeight(double value)Set the weight for the signal.java.lang.StringtoString()
-
-
-
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
-
-
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 signalsignalType- the type of the signal (click, rate, screen time)signalStrength- the strength of the signalqueryString- 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 signalsignalType- 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 signalsignalType- 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)
-
getFeatureVector
public RelevancyFeatureVector getFeatureVector()
-
setFeatureVector
public void setFeatureVector(RelevancyFeatureVector featureVector)
-
getPrincipal
public AttivioPrincipal getPrincipal()
-
setPrincipal
public void setPrincipal(AttivioPrincipal principal)
-
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
-1if 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
protected Signal clone() throws java.lang.CloneNotSupportedException
- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-