Class QueryResponse
- java.lang.Object
-
- com.attivio.sdk.esb.AbstractPlatformMessage
-
- com.attivio.sdk.search.QueryResponse
-
- All Implemented Interfaces:
PlatformMessage
,java.io.Serializable
,java.lang.Cloneable
public class QueryResponse extends AbstractPlatformMessage implements java.io.Serializable
QueryResponse contains the response to aQueryRequest
.The response may contain any of the following based on the initial request:
- The
QueryRequest
after modifications by all query request/response transformers. NOTE: this should NOT be reused. - The documents that matched the query inside a
SearchDocumentList
- The facet results if any were requested.
- Any query feedback generated by query/response transformers. These could contain spelling suggestions, or information messages about any processing that took place.
- Basic timing information about how long various part of the search took.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SPELLCHECK_SUGGESTED
The response property containing the spellcheck suggested querystatic java.lang.String
SPELLCHECK_SUGGESTED_MARKEDUP
The response property containing the marked up spellcheck suggested querystatic java.lang.String
STATISTICS_LINGUISTICS_INFO
The response property containing the query linguistics infostatic java.lang.String
STATISTICS_QUERY_INFO
The response property containing the query statisticsstatic java.lang.String
TERMCOUNTCHECK_REPORT
The response property containing the term count check report-
Fields inherited from interface com.attivio.sdk.esb.PlatformMessage
DEFAULT_MAX_LOG_LENGTH, MESSAGE_DROPPED, MESSAGE_SEND_TIME_PROP, PROP_MAX_LOG_LENGTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QueryResponse()
QueryResponse(QueryRequest request)
Creates a new QueryResponse from a QueryRequest object.QueryResponse(java.util.UUID clientId, WorkflowQueue workflows)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFacet(FacetResponse value)
Add a facet to the response.QueryFeedback
addFeedback(QueryFeedback message)
Add a feedback message.void
addFeedback(QueryFeedback... value)
Add multiple feedback messages.QueryFeedback
addFeedback(java.lang.String stageName, java.lang.String messageName, java.lang.String message)
Add a feedback message.QueryFeedback
addFeedback(java.lang.String stageName, java.lang.String messageName, java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> properties)
Add a feedback message.void
addFeedback(java.util.List<QueryFeedback> value)
Add multiple feedback messages.void
addPlacement(QueryPlacement value)
QueryResponse
clone()
Clones the object and resets message ID to -1.boolean
equals(java.lang.Object other)
SearchDocumentList
getDocuments()
Get the documents returned for this response.FacetResponse
getFacet(java.lang.String name)
Gets a facet by name.java.util.List<FacetResponse>
getFacets()
Get the generated facets for this response.long
getFacetTime()
Get the number of milliseconds taken to compute facets.java.util.List<QueryFeedback>
getFeedback()
Get all feedback messages for this response.java.util.List<QueryFeedback>
getFeedbackByMessageName(java.lang.String messageName)
Get all query feedback that has a message specific message name.long
getHighlightTime()
Get the number of milliseconds taken to highlight results.java.util.List<QueryPlacement>
getPlacements()
Get all placements for this response.QueryRequest
getQueryRequest()
Get theQueryRequest
for this response.long
getQueryTimestamp()
Get the timestamp the query was receivedlong
getResponseTime()
The total time spent processing a request including network and serialization time in milliseconds.long
getResultTime()
Get the number of milliseconds taken to generate results.java.lang.String
getSchemaName()
Get the schema name specified for the request.long
getSearchTime()
Get the number of milliseconds taken to execute the search.long
getTotalRows()
Gets the total number of rows that matched the query.long
getWorkflowTime()
Get the number of milliseconds spent in workflow stages.int
hashCode()
void
setDocuments(SearchDocumentList value)
Set the documents to return with this repsonse.void
setFacets(FacetResponse... value)
Set the generated facets for this response.void
setFacets(java.util.List<FacetResponse> value)
Set the generated facets for this response.void
setFacetTime(long time)
Set the number of milliseconds taken to compute facets.void
setFeedback(java.util.List<QueryFeedback> value)
void
setHighlightTime(long time)
Set the number of milliseconds taken to highlight results.void
setPlacements(java.util.List<QueryPlacement> value)
void
setQueryRequest(QueryRequest value)
Set theQueryRequest
for this response.void
setQueryTimestamp(long queryTime)
Set the timestamp the query was receivedvoid
setResultTime(long time)
Set the number of milliseconds taken to generate results.void
setSearchTime(long time)
Set the number of milliseconds taken to execute the search.void
setWorkflowTime(long time)
Set the number of milliseconds spent in workflow stages.protected java.lang.StringBuilder
toString(java.lang.StringBuilder buffer)
Append the string form of this request tobuffer
.-
Methods inherited from class com.attivio.sdk.esb.AbstractPlatformMessage
addMessageHistory, addMessageHistory, getClientId, getEstimatedSize, getMessageHistory, getMessageId, getMetadata, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getWorkflowQueue, getWorkflowQueue, hasProperty, isRedelivered, removeProperty, removeWorkflowQueue, setClientId, setMessageId, setProperty, setRedelivered, setWorkflowQueue, setWorkflowQueue, toMessageString, toString, toString, toString, toString, toString, toString, toString, toString, toString
-
-
-
-
Field Detail
-
SPELLCHECK_SUGGESTED
public static final java.lang.String SPELLCHECK_SUGGESTED
The response property containing the spellcheck suggested query- See Also:
- Constant Field Values
-
SPELLCHECK_SUGGESTED_MARKEDUP
public static final java.lang.String SPELLCHECK_SUGGESTED_MARKEDUP
The response property containing the marked up spellcheck suggested query- See Also:
- Constant Field Values
-
TERMCOUNTCHECK_REPORT
public static final java.lang.String TERMCOUNTCHECK_REPORT
The response property containing the term count check report- See Also:
- Constant Field Values
-
STATISTICS_QUERY_INFO
public static final java.lang.String STATISTICS_QUERY_INFO
The response property containing the query statistics- See Also:
- Constant Field Values
-
STATISTICS_LINGUISTICS_INFO
public static final java.lang.String STATISTICS_LINGUISTICS_INFO
The response property containing the query linguistics info- See Also:
- Constant Field Values
-
-
Constructor Detail
-
QueryResponse
protected QueryResponse()
-
QueryResponse
public QueryResponse(QueryRequest request)
Creates a new QueryResponse from a QueryRequest object.Any workflows set on
request
are transferred to the new query response, that is they do not remain onrequest
.
-
QueryResponse
public QueryResponse(java.util.UUID clientId, WorkflowQueue workflows)
-
-
Method Detail
-
getSchemaName
public java.lang.String getSchemaName()
Get the schema name specified for the request.
-
getTotalRows
public long getTotalRows()
Gets the total number of rows that matched the query.
-
getDocuments
public SearchDocumentList getDocuments()
Get the documents returned for this response.NOTE: this will only contain a "window" over the total result set based on the requested number of rows and offset requested.
-
setDocuments
public void setDocuments(SearchDocumentList value)
Set the documents to return with this repsonse.
-
getQueryRequest
public QueryRequest getQueryRequest()
Get theQueryRequest
for this response.NOTE: this may be null in order to optimize network traffic.
-
setQueryRequest
public void setQueryRequest(QueryRequest value)
Set theQueryRequest
for this response.
-
getWorkflowTime
public long getWorkflowTime()
Get the number of milliseconds spent in workflow stages.This is the total time spent during workflow processing. This included search time/facet time/response time.
-
setWorkflowTime
public void setWorkflowTime(long time)
Set the number of milliseconds spent in workflow stages.
-
getResponseTime
public long getResponseTime()
The total time spent processing a request including network and serialization time in milliseconds.
-
getSearchTime
public long getSearchTime()
Get the number of milliseconds taken to execute the search.This time only takes into account the time spent matching and ordering results.
-
setSearchTime
public void setSearchTime(long time)
Set the number of milliseconds taken to execute the search.
-
getFacetTime
public long getFacetTime()
Get the number of milliseconds taken to compute facets.
-
setFacetTime
public void setFacetTime(long time)
Set the number of milliseconds taken to compute facets.
-
getResultTime
public long getResultTime()
Get the number of milliseconds taken to generate results.This is the time taken to create the
SearchDocument
s for the response.
-
setResultTime
public void setResultTime(long time)
Set the number of milliseconds taken to generate results.
-
getHighlightTime
public long getHighlightTime()
Get the number of milliseconds taken to highlight results.NOTE: this is the total CPU time spent during highlighting. This may be greater than the wall clock time in the case of multi-column installations.
-
setHighlightTime
public void setHighlightTime(long time)
Set the number of milliseconds taken to highlight results.
-
getQueryTimestamp
public long getQueryTimestamp()
Get the timestamp the query was received- Returns:
- timestamp
-
setQueryTimestamp
public void setQueryTimestamp(long queryTime)
Set the timestamp the query was received
-
getFacets
public java.util.List<FacetResponse> getFacets()
Get the generated facets for this response.NOTE: this method will never return
null
.
-
getFacet
public FacetResponse getFacet(java.lang.String name)
Gets a facet by name.- Returns:
- a facet response, or null if the facet is not found
-
setFacets
public void setFacets(java.util.List<FacetResponse> value)
Set the generated facets for this response.
-
setFacets
public void setFacets(FacetResponse... value)
Set the generated facets for this response.
-
addFacet
public void addFacet(FacetResponse value)
Add a facet to the response.
-
getPlacements
public java.util.List<QueryPlacement> getPlacements()
Get all placements for this response.
-
setPlacements
public void setPlacements(java.util.List<QueryPlacement> value)
-
addPlacement
public void addPlacement(QueryPlacement value)
-
getFeedback
public java.util.List<QueryFeedback> getFeedback()
Get all feedback messages for this response.
-
setFeedback
public void setFeedback(java.util.List<QueryFeedback> value)
-
getFeedbackByMessageName
public java.util.List<QueryFeedback> getFeedbackByMessageName(java.lang.String messageName)
Get all query feedback that has a message specific message name.
-
addFeedback
public QueryFeedback addFeedback(QueryFeedback message)
Add a feedback message.
-
addFeedback
public void addFeedback(java.util.List<QueryFeedback> value)
Add multiple feedback messages.
-
addFeedback
public void addFeedback(QueryFeedback... value)
Add multiple feedback messages.
-
addFeedback
public QueryFeedback addFeedback(java.lang.String stageName, java.lang.String messageName, java.lang.String message)
Add a feedback message.
-
addFeedback
public QueryFeedback addFeedback(java.lang.String stageName, java.lang.String messageName, java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> properties)
Add a feedback message.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractPlatformMessage
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classAbstractPlatformMessage
-
toString
protected java.lang.StringBuilder toString(java.lang.StringBuilder buffer)
Append the string form of this request tobuffer
.- Overrides:
toString
in classAbstractPlatformMessage
-
clone
public QueryResponse clone()
Clones the object and resets message ID to -1. Clones a message. The message ID is not cloned.- Specified by:
clone
in interfacePlatformMessage
- Overrides:
clone
in classAbstractPlatformMessage
- Returns:
- the cloned index message
-
-