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 class
Signal.SimpleSignalCompare
Compares 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 Signal
clone()
int
compareTo(Signal o)
boolean
equals(java.lang.Object obj)
java.lang.String
getDocId()
long
getDocOrdinal()
Get the document ordinal (1-indexed).long
getEstimatedSize()
RelevancyFeatureVector
getFeatureVector()
java.util.Locale
getLocale()
AttivioPrincipal
getPrincipal()
java.lang.String
getQuery()
static java.lang.String
getQueryString(Query query)
Get the original query string out of the query...long
getQueryTimestamp()
java.lang.String
getRegion()
Get the region where this signal originated.java.lang.String
getRelevancyModelName()
Get the name for the relevancy model that scored the result associated with this signal.java.lang.String[]
getRelevancyModelNames()
long
getRelevancyModelVersion()
Get the version for the relevancy model that scored the result associated with this signal.static Signal
getSignal(QueryResponse queryResponse, int documentIndex)
Create a click signal with a strength of onestatic Signal
getSignal(QueryResponse queryResponse, int documentIndex, java.lang.String signalType)
Create a signal with a signal strength of onestatic Signal
getSignal(QueryResponse queryResponse, int documentIndex, java.lang.String signalType, double signalStrength)
Create a signal for a given document in the query response.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.long
getSignalTimestamp()
java.lang.String
getType()
Get the signal type.double
getWeight()
Get the weight for the signal.int
hashCode()
boolean
isTTL()
Get if TTL will be honored for this signal.boolean
isValid()
Deprecated.always returns truevoid
setDocId(java.lang.String value)
void
setDocOrdinal(long value)
Set the document ordinal (1-indexed).void
setFeatureVector(RelevancyFeatureVector featureVector)
void
setLocale(java.util.Locale locale)
void
setPrincipal(AttivioPrincipal principal)
void
setQuery(java.lang.String value)
void
setQueryTimestamp(long queryTimestamp)
void
setRegion(java.lang.String region)
Set the region where this signal originated.void
setRelevancyModelName(java.lang.String value)
Set the name for the relevancy model that scored the result associated with this signal.void
setRelevancyModelNames(java.lang.String... value)
void
setRelevancyModelVersion(long value)
Set the version for the relevancy model that scored the result associated with this signal.void
setSignalTimestamp(long signalTimestamp)
void
setTTL(boolean value)
Get if TTL will be honored for this signal.void
setType(java.lang.String value)
Set the signal type.void
setWeight(double value)
Set the weight for the signal.java.lang.String
toString()
-
-
-
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. If the query passed in is null, this returns null right away. This will happen if the query request was made with the metadata flag turned off...- 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)
- Parameters:
value
- the docId to set
-
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)
- Parameters:
value
- the query to set
-
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)
-
getRegion
public java.lang.String getRegion()
Get the region where this signal originated.This is used for signals replicated as part of a multi-region deployment.
- Returns:
String
the region; can benull
-
setRegion
public void setRegion(java.lang.String region)
Set the region where this signal originated.This is used for signals replicated as part of a multi-region deployment.
- Parameters:
region
-String
the region; can benull
-
isValid
@Deprecated public boolean isValid()
Deprecated.always returns true
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
protected Signal clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
compareTo
public int compareTo(Signal o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Signal>
-
getEstimatedSize
public long getEstimatedSize()
-
-