public abstract class SearchResponse
extends atg.search.routing.command.SearchEngineCommandResponse
SearchEngineCommandResponse
that also provides search-command-specific information.
This class is the counterpart to SearchRequest
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected boolean |
mMultiPartitionSearch |
Modifier | Constructor and Description |
---|---|
protected |
SearchResponse() |
protected |
SearchResponse(atg.search.routing.command.SearchEngineResponse response) |
Modifier and Type | Method and Description |
---|---|
void |
addError(atg.search.routing.command.SearchEngineError error)
Adds a search error to the list of errors
|
double |
getBuildTimeMs()
Returns the time spent building the response object from the parsed message, in milliseconds.
|
java.lang.String |
getContentId()
Returns the unique content guid for the partition that provided this response, if the request
type supports its return.
|
java.util.Collection<atg.search.routing.command.SearchEngineError> |
getErrors()
Returns a Collection of
SearchEngineError objects, possibly null |
java.util.List<java.lang.String> |
getListableProperties()
Controls which document properties will be Lists
|
double |
getMergeTimeMs()
Returns the time spent merging responses in milliseconds
|
double |
getParseTimeMs()
Returns the time, in milliseconds, spent parsing the message.
|
java.util.Collection |
getPartitionResponses()
Returns null or Collection of
SearchEngineResponse objects that were merged. |
java.lang.String |
getRequestChainToken()
Returns a unique request chain token that can be used in a subsequent request to establish a request chain.
|
java.lang.String |
getRequestIdentifier()
Returns the server-generated request identifier, or null if one wasn't generated
|
long |
getRequestTime()
Returns the time of day of the response, in milliseconds since 1970
|
atg.search.routing.SearchTargetNames |
getSearchTargetNames()
Returns the search target names actually used during the search, plus generated or looked-up ids
|
double |
getTotalResponseTimeMs()
Total response time in milliseconds, including original requests, merge, and all java processing.
|
java.lang.String |
getXmlString()
Returns the decoded xml response, but throws an exception if ill-formed.
|
protected void |
handleMerge(SearchRequest pRequest,
java.util.List<SearchResponse> pParsedResponses)
Handles the merge of multiple responses.
|
boolean |
isAllowListProperties()
Indicates whether document properties will be Lists or Strings
|
boolean |
isLocalMergeEnabled()
Returns true if the original request had local merge enabled.
|
boolean |
isMultiPartitionSearch()
Indicates whether a multiple-partition index was searched
|
boolean |
isOverloaded()
Indicates whether the request failed as a result of an overload.
|
boolean |
isTimedOut()
Indicates whether the request failed as a result of a timeout.
|
protected abstract void |
merge(SearchRequest pRequest,
java.util.List<SearchResponse> pParsedResponses)
This is local merge.
|
void |
setAllowListProperties(boolean allowListProperties)
Controls whether document properties will be Lists or Strings
|
void |
setBuildTimeMs(double pBuildTimeMs)
Sets the time spent building the response, in milliseconds.
|
void |
setErrors(java.util.Collection<atg.search.routing.command.SearchEngineError> errors)
Sets a Collection of
SearchEngineError objects |
void |
setListableProperties(java.util.List<java.lang.String> pListableProperties)
Controls which document properties will be Lists
|
void |
setLocalMergeEnabled(boolean pLocalMergeEnabled)
Sets local merge indicator from the request.
|
void |
setMergeTimeMs(double pMergeTimeMs)
Sets the time spent merging responses in milliseconds
|
void |
setMultiPartitionSearch(boolean multiPartitionSearch)
Sets the indicator showing whether a multiple-partition index was searched
|
void |
setParseTimeMs(double pParseTimeMs)
Sets the time, in milliseconds, spent parsing the message.
|
void |
setPartitionResponses(java.util.Collection partitionResponses)
Sets the Collection of
SearchEngineResponse objects that were merged |
void |
setRequestChainToken(java.lang.String pRequestChainToken)
Sets an identifier that identifies the associated request chain.
|
void |
setRequestIdentifier(java.lang.String requestIdentifier)
An identifier generated on the server side that identifies the associated request.
|
void |
setRequestTime(long pRequestTime)
Sets the time of day of the response, in milliseconds since 1970.
|
void |
setSearchTargetNames(atg.search.routing.SearchTargetNames pSearchTargetNames)
Sets target names actually used during the search
|
void |
setTotalResponseTimeMs(double pTotalResponseTimeMs)
Sets the total response time in milliseconds, including original requests, merge, and all java processing.
|
java.lang.String |
toString()
Returns the decoded xml response
|
getNextResponse, getNonSAXParser, getRequestTag, getSearchEngineResponse, parseResponse, setNextResponse, setSearchEngineResponse
appendComplexXml, appendOptionalAttr, appendOptionalElem, appendOptionalElem, appendOptionalElem, appendOptionalValue, appendRequiredAttr, appendRequiredElem, appendRequiredElem, appendRequiredValue, getAllAttributeXML, getAllBodyXML, getAttributeXML, getBodyXML, getDefaultXmlBytes, getParentXMLObject, getXmlPath, isPrintedFirstChild, setParentXMLObject, setPrintedFirstChild, toXML, toXML
public static java.lang.String CLASS_VERSION
protected boolean mMultiPartitionSearch
protected SearchResponse()
protected SearchResponse(atg.search.routing.command.SearchEngineResponse response)
public java.lang.String getContentId()
public boolean isLocalMergeEnabled()
public void setLocalMergeEnabled(boolean pLocalMergeEnabled)
pLocalMergeEnabled
- true if the request had local merge enabledprotected abstract void merge(SearchRequest pRequest, java.util.List<SearchResponse> pParsedResponses) throws atg.search.routing.MergeException
SearchEngineResponse
or provide any timing.
The Response class must provide a constructor that looks like the one below and invokes
handleMerge(atg.search.routing.command.search.SearchRequest,java.util.List)
.
The implementation of this method should only handle merge. See QueryRequest.Response.merge(SearchRequest, java.util.List)
public Response(YourRequest pRequest,
List<SearchResponse> pParsedResponses) throws MergeException
{
handleMerge(pRequest, pParsedResponses);
}
pRequest
- the original requestpParsedResponses
- pre-parsed responsesatg.search.routing.MergeException
- if the merge failsprotected void handleMerge(SearchRequest pRequest, java.util.List<SearchResponse> pParsedResponses) throws atg.search.routing.MergeException
merge(atg.search.routing.command.search.SearchRequest,java.util.List)
.pRequest
- the original requestpParsedResponses
- pre-parsed responsesatg.search.routing.MergeException
- if the merge failspublic void addError(atg.search.routing.command.SearchEngineError error)
error
- an errorpublic long getRequestTime()
public void setRequestTime(long pRequestTime)
pRequestTime
- time of day of the response, in milliseconds since 1970public double getTotalResponseTimeMs()
public void setTotalResponseTimeMs(double pTotalResponseTimeMs)
pTotalResponseTimeMs
- total response time in mspublic boolean isTimedOut()
Configuration.getReadTimeoutMs()
.public boolean isOverloaded()
public boolean isAllowListProperties()
public void setAllowListProperties(boolean allowListProperties)
allowListProperties
- whether document properties will be Lists or Stringspublic java.util.List<java.lang.String> getListableProperties()
public void setListableProperties(java.util.List<java.lang.String> pListableProperties)
pListableProperties
- set indicating which properties will be Listspublic java.lang.String getRequestIdentifier()
public void setRequestIdentifier(java.lang.String requestIdentifier)
requestIdentifier
- server-generated request identifier, or null if one wasn't generatedpublic java.lang.String getRequestChainToken()
SearchRequest.setRequestChainToken(String)
public void setRequestChainToken(java.lang.String pRequestChainToken)
pRequestChainToken
- An identifier generated on the server side that identifies the associated request chainpublic java.util.Collection<atg.search.routing.command.SearchEngineError> getErrors()
SearchEngineError
objects, possibly nullSearchEngineError
objects, possibly nullpublic void setErrors(java.util.Collection<atg.search.routing.command.SearchEngineError> errors)
SearchEngineError
objectserrors
- Collection of SearchEngineError
objectspublic boolean isMultiPartitionSearch()
public void setMultiPartitionSearch(boolean multiPartitionSearch)
multiPartitionSearch
- whether a multiple-partition index was searchedpublic double getBuildTimeMs()
getParseTimeMs()
.public void setBuildTimeMs(double pBuildTimeMs)
pBuildTimeMs
- time spent parsing the responsepublic double getParseTimeMs()
getBuildTimeMs()
.public void setParseTimeMs(double pParseTimeMs)
pParseTimeMs
- the time, in milliseconds, spent parsing the messagepublic double getMergeTimeMs()
public void setMergeTimeMs(double pMergeTimeMs)
pMergeTimeMs
- the time spent merging responses in millisecondspublic java.util.Collection getPartitionResponses()
SearchEngineResponse
objects that were merged. Normally null.SearchEngineResponse
objects that were mergedpublic void setPartitionResponses(java.util.Collection partitionResponses)
SearchEngineResponse
objects that were mergedpartitionResponses
- Collection of SearchEngineResponse
objects that were mergedpublic java.lang.String toString()
toString
in class atg.search.routing.command.SearchXMLObject
public java.lang.String getXmlString() throws atg.search.routing.command.IncompleteCommandException
atg.search.routing.command.IncompleteCommandException
public void setSearchTargetNames(atg.search.routing.SearchTargetNames pSearchTargetNames)
pSearchTargetNames
- target names actually used during the searchpublic atg.search.routing.SearchTargetNames getSearchTargetNames()