atg.search.routing.command.search
Class SearchResponse

java.lang.Object
  extended by atg.search.routing.command.SearchXMLObject
      extended by atg.search.routing.command.SearchEngineCommandResponse
          extended by atg.search.routing.command.search.SearchResponse
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BrowseRequest.Response, CategorizeRequest.Response, SearchResultsResponse, TreeQueryRequest.Response, TypeAheadRequest.Response, ViewDocumentRequest.Response

public abstract class SearchResponse
extends atg.search.routing.command.SearchEngineCommandResponse

A SearchEngineCommandResponse that also provides search-command-specific information. This class is the counterpart to SearchRequest.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  boolean mMultiPartitionSearch
           
 
Constructor Summary
protected SearchResponse()
           
protected SearchResponse(atg.search.routing.command.SearchEngineResponse response)
           
 
Method Summary
 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
 
Methods inherited from class atg.search.routing.command.SearchEngineCommandResponse
getNextResponse, getNonSAXParser, getRequestTag, getSearchEngineResponse, parseResponse, setNextResponse, setSearchEngineResponse
 
Methods inherited from class atg.search.routing.command.SearchXMLObject
appendComplexXml, appendOptionalAttr, appendOptionalElem, appendOptionalElem, appendOptionalElem, appendOptionalValue, appendRequiredAttr, appendRequiredElem, appendRequiredElem, appendRequiredValue, getAllAttributeXML, getAllBodyXML, getAttributeXML, getBodyXML, getDefaultXmlBytes, getParentXMLObject, getXmlPath, isPrintedFirstChild, setParentXMLObject, setPrintedFirstChild, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mMultiPartitionSearch

protected boolean mMultiPartitionSearch
Constructor Detail

SearchResponse

protected SearchResponse()

SearchResponse

protected SearchResponse(atg.search.routing.command.SearchEngineResponse response)
Method Detail

getContentId

public java.lang.String getContentId()
Returns the unique content guid for the partition that provided this response, if the request type supports its return. If not supported, null is returned.

Returns:
content guid, if supported, otherwise null

isLocalMergeEnabled

public boolean isLocalMergeEnabled()
Returns true if the original request had local merge enabled.

Returns:
true if the original request had local merge enabled

setLocalMergeEnabled

public void setLocalMergeEnabled(boolean pLocalMergeEnabled)
Sets local merge indicator from the request. This should be true if it was true for the request.

Parameters:
pLocalMergeEnabled - true if the request had local merge enabled

merge

protected abstract void merge(SearchRequest pRequest,
                              java.util.List<SearchResponse> pParsedResponses)
                       throws atg.search.routing.MergeException
This is local merge. Implementations do not need to check the array for nullness or size. Nor do implementations need to allocate or set a 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);
}

Parameters:
pRequest - the original request
pParsedResponses - pre-parsed responses
Throws:
atg.search.routing.MergeException - if the merge fails

handleMerge

protected void handleMerge(SearchRequest pRequest,
                           java.util.List<SearchResponse> pParsedResponses)
                    throws atg.search.routing.MergeException
Handles the merge of multiple responses. Each subclass is responsible for implementing merge(atg.search.routing.command.search.SearchRequest,java.util.List).

Parameters:
pRequest - the original request
pParsedResponses - pre-parsed responses
Throws:
atg.search.routing.MergeException - if the merge fails

addError

public void addError(atg.search.routing.command.SearchEngineError error)
Adds a search error to the list of errors

Parameters:
error - an error

getRequestTime

public long getRequestTime()
Returns the time of day of the response, in milliseconds since 1970

Returns:
time of day of the response, in milliseconds since 1970

setRequestTime

public void setRequestTime(long pRequestTime)
Sets the time of day of the response, in milliseconds since 1970. This is set automatically by Routing, and does not need to be called.

Parameters:
pRequestTime - time of day of the response, in milliseconds since 1970

getTotalResponseTimeMs

public double getTotalResponseTimeMs()
Total response time in milliseconds, including original requests, merge, and all java processing. This is the most inclusive measure of the response time available.

Returns:
total response time in ms, including everything

setTotalResponseTimeMs

public void setTotalResponseTimeMs(double pTotalResponseTimeMs)
Sets the total response time in milliseconds, including original requests, merge, and all java processing. This is the most inclusive measure of the the response time available.

Parameters:
pTotalResponseTimeMs - total response time in ms

isTimedOut

public boolean isTimedOut()
Indicates whether the request failed as a result of a timeout. The timeout is determined by Configuration.getReadTimeoutMs().

Returns:
whether the request failed as a result of a timeout

isOverloaded

public boolean isOverloaded()
Indicates whether the request failed as a result of an overload.

Returns:
whether the request failed as a result of an overload

isAllowListProperties

public boolean isAllowListProperties()
Indicates whether document properties will be Lists or Strings

Returns:
whether document properties will be Lists or Strings

setAllowListProperties

public void setAllowListProperties(boolean allowListProperties)
Controls whether document properties will be Lists or Strings

Parameters:
allowListProperties - whether document properties will be Lists or Strings

getListableProperties

public java.util.List<java.lang.String> getListableProperties()
Controls which document properties will be Lists

Returns:
Set of properties that will be Lists

setListableProperties

public void setListableProperties(java.util.List<java.lang.String> pListableProperties)
Controls which document properties will be Lists

Parameters:
pListableProperties - set indicating which properties will be Lists

getRequestIdentifier

public java.lang.String getRequestIdentifier()
Returns the server-generated request identifier, or null if one wasn't generated

Returns:
server-generated request identifier, or null if one wasn't generated

setRequestIdentifier

public void setRequestIdentifier(java.lang.String requestIdentifier)
An identifier generated on the server side that identifies the associated request.

Parameters:
requestIdentifier - server-generated request identifier, or null if one wasn't generated

getRequestChainToken

public java.lang.String getRequestChainToken()
Returns a unique request chain token that can be used in a subsequent request to establish a request chain. The chain will have its own paging information, even if there are other request chains in this session.

Returns:
request chain identifier from the request
See Also:
SearchRequest.setRequestChainToken(String)

setRequestChainToken

public void setRequestChainToken(java.lang.String pRequestChainToken)
Sets an identifier that identifies the associated request chain. Handled automatically.

Parameters:
pRequestChainToken - An identifier generated on the server side that identifies the associated request chain

getErrors

public java.util.Collection<atg.search.routing.command.SearchEngineError> getErrors()
Returns a Collection of SearchEngineError objects, possibly null

Returns:
Collection of SearchEngineError objects, possibly null

setErrors

public void setErrors(java.util.Collection<atg.search.routing.command.SearchEngineError> errors)
Sets a Collection of SearchEngineError objects

Parameters:
errors - Collection of SearchEngineError objects

isMultiPartitionSearch

public boolean isMultiPartitionSearch()
Indicates whether a multiple-partition index was searched

Returns:
whether a multiple-partition index was searched

setMultiPartitionSearch

public void setMultiPartitionSearch(boolean multiPartitionSearch)
Sets the indicator showing whether a multiple-partition index was searched

Parameters:
multiPartitionSearch - whether a multiple-partition index was searched

getBuildTimeMs

public double getBuildTimeMs()
Returns the time spent building the response object from the parsed message, in milliseconds. To get the parsing time, call getParseTimeMs().

Returns:
time spent parsing the response, in milliseconds

setBuildTimeMs

public void setBuildTimeMs(double pBuildTimeMs)
Sets the time spent building the response, in milliseconds. This process follows parsing

Parameters:
pBuildTimeMs - time spent parsing the response

getParseTimeMs

public double getParseTimeMs()
Returns the time, in milliseconds, spent parsing the message. This does not include any response building. See getBuildTimeMs().

Returns:
the time, in milliseconds, spent parsing the message

setParseTimeMs

public void setParseTimeMs(double pParseTimeMs)
Sets the time, in milliseconds, spent parsing the message.

Parameters:
pParseTimeMs - the time, in milliseconds, spent parsing the message

getMergeTimeMs

public double getMergeTimeMs()
Returns the time spent merging responses in milliseconds

Returns:
time spent merging responses in milliseconds

setMergeTimeMs

public void setMergeTimeMs(double pMergeTimeMs)
Sets the time spent merging responses in milliseconds

Parameters:
pMergeTimeMs - the time spent merging responses in milliseconds

getPartitionResponses

public java.util.Collection getPartitionResponses()
Returns null or Collection of SearchEngineResponse objects that were merged. Normally null.

Returns:
null or Collection of SearchEngineResponse objects that were merged

setPartitionResponses

public void setPartitionResponses(java.util.Collection partitionResponses)
Sets the Collection of SearchEngineResponse objects that were merged

Parameters:
partitionResponses - Collection of SearchEngineResponse objects that were merged

toString

public java.lang.String toString()
Returns the decoded xml response

Overrides:
toString in class atg.search.routing.command.SearchXMLObject
Returns:
decoded xml response

getXmlString

public java.lang.String getXmlString()
                              throws atg.search.routing.command.IncompleteCommandException
Returns the decoded xml response, but throws an exception if ill-formed.

Returns:
decoded xml response
Throws:
atg.search.routing.command.IncompleteCommandException

setSearchTargetNames

public void setSearchTargetNames(atg.search.routing.SearchTargetNames pSearchTargetNames)
Sets target names actually used during the search

Parameters:
pSearchTargetNames - target names actually used during the search

getSearchTargetNames

public atg.search.routing.SearchTargetNames getSearchTargetNames()
Returns the search target names actually used during the search, plus generated or looked-up ids

Returns:
search target names actually used during the search, plus generated or looked-up ids