atg.search.routing.command.search
Class SearchRequest

java.lang.Object
  extended by atg.search.routing.command.SearchXMLObject
      extended by atg.search.routing.command.SearchEngineRequestImpl
          extended by atg.search.routing.command.search.SearchRequest
All Implemented Interfaces:
atg.search.routing.command.SearchEngineRequest, java.io.Serializable
Direct Known Subclasses:
BrowseRequest, CategorizeRequest, QueryRequest, SimilarDocsRequest, StructuredQueryRequest, TreeQueryRequest, TypeAheadRequest, ViewDocumentRequest

public abstract class SearchRequest
extends atg.search.routing.command.SearchEngineRequestImpl
implements java.io.Serializable

All search requests extend this. Indexing and Deploy requests do not. Maintains a few select properties that are common to all search requests.

See Also:
Serialized Form

Field Summary
static int BROWSE
           
protected static java.lang.String CACHEABLE
           
static int CATEGORIZE
           
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String DEBUG
           
protected static java.lang.String[] EMPTY_ARRAY
           
protected static java.lang.String ENV
           
protected static java.lang.String ID
           
static int INSPECT
           
protected static java.lang.String LIST_PROPERTY_ALLOWED
           
protected static java.lang.String LISTABLE_PROPERTIES
           
protected static java.lang.String LOCAL_MERGE
           
protected static java.lang.String LOCAL_MERGE_DEBUG
           
protected static java.lang.String LOG_THIS_REQUEST
           
protected  java.lang.Boolean mDebug
          engine debugging
protected  java.util.List<java.lang.String> mListableProperties
          to support specific list properties in the results.
protected  boolean mListPropertyAllowed
          to support list properties in the results.
protected  boolean mLocalMergeDebugEnabled
          Java merge debugging.
protected  boolean mLocalMergeDebugReady
          Java merge debugging ready.
protected  boolean mLocalMergeEnabled
          Controls local merge.
protected  java.lang.String mMergeSettings
          response number settings for merge
protected  boolean mMultiPartitionSearch
          indicates a multiple partition search.
protected  java.lang.String mRequestIdentifier
          uniquely identifies this request.
protected static double MsInNs
           
protected  java.lang.Integer mSleepTimeMs
          forces the engine to go to sleep during the call, for testing timeouts
protected  atg.search.routing.SearchTargetNames mTargets
          combined object for all search target names--environment, LPs, and excluded LPs
protected  java.lang.Integer mTimeLimitMs
          Time limit in ms before this request times out.
protected static java.lang.String MULTI_PARTITION
           
protected static java.lang.String MULTI_SEARCH_SESSION
           
protected  java.lang.String mVersion
          engine version, not used
static int QUERY
           
protected static java.lang.String RESP_FORM
           
protected static java.lang.String SAVE_REQUEST
           
static int SIMILARDOCS
           
protected static java.lang.String SITE_CONSTR
           
protected static java.lang.String SITE_ID
           
protected static java.lang.String SLEEP_TIME_MS
           
static int STRUCTQUERY
           
static java.lang.String[] TAGS
          XML tags for the different requests.
protected static java.lang.String TIME
           
protected static java.lang.String TIME_LIMIT_MS
           
static int TREEQUERY
           
static int TYPEAHEAD
           
protected static java.lang.String VERSION
           
static int VIC
           
 
Constructor Summary
SearchRequest()
           
 
Method Summary
protected  SearchResponse doMerge(java.util.List<SearchResponse> pParsedResponses)
          Default implementation returns the first element of the array and tosses the rest.
 void fillDynamicTargets(atg.search.routing.command.search.DynamicTarget msTarget)
           
 void fillDynamicTargetSpecifier()
           
protected  void fromXml(atg.search.routing.utils.SearchMessageNode pXml)
          populates common attributes from xml.
protected  void getAllAttributeXML(java.lang.StringBuilder cmd)
          Inserts attributes for all commands.
protected  void getAllBodyXML(java.lang.StringBuilder sb)
           
 java.lang.String getAssociatedRequestIdentifier()
          This is typically a search request that came before a ViewDocument request.
 java.util.List<java.lang.String> getContentLabels()
          returns the content label(s) for this request, which indicate site-specific content to be searched
 java.lang.String[] getContentLabelsArray()
          Returns the content label(s) for this request, which indicate site-specific content to be searched
 java.lang.Boolean getDebug()
          Indicates whether debugging should be enabled for this request on the engine
 atg.search.routing.command.search.DynamicTargetSpecifier getDynamicTargetSpecifier()
           
 java.util.List getExcludeLogicalPartitionNames()
          Returns the List of excluded Logical Partition names
 SearchResponse getLastResponse()
          Returns the last response.
 java.util.List<java.lang.String> getListableProperties()
          Returns the set of properties that will be stored as lists in the response.
 java.lang.String getListablePropertiesString()
           
 java.util.List getLogicalPartitionNames()
          Returns the List of targeted Logical Partitions' names
 java.lang.String[] getLogicalPartitionsArray()
          Returns array of targeted Logical Partitions' names
 int getMaximumResults()
          This is only for JSPs that might want to keep the number of results with the request.
 java.lang.String getMergeSettings()
          This is not part of a regular request.
 java.lang.String getPreviousRequestChainToken()
          Returns the identifier for the previous chain of requests.
 java.lang.String getRequestAttribute(java.lang.Object attributeName)
          provided for compatibility.
 java.util.Map getRequestAttributes()
          provided for compatibility, but a no-op, and returns null.
 java.lang.String getRequestChainToken()
          a unique identifier for a chain of requests.
abstract  int getRequestId()
          This identifies the type of request, one of QUERY, BROWSE, etc.
 java.lang.String getRequestIdentifier()
          The request id is available after Routing has processed the request.
 java.lang.String getRequestTag()
          Gets the xml element tag used in the request
 long getRequestTime()
          The time of day that the request occured, in milliseconds since 1970.
 ResponseFormat getRespForm()
          The search engine response format.
 java.lang.String getSearchEnvironmentName()
          Returns the target search environment name, which may be null.
 atg.search.routing.SearchTargetNames getSearchTargetNames()
          Returns the search target names for this request.
 atg.search.routing.command.search.MultisiteConstraint getSiteConstraints()
          Returns the site constraints.
 java.lang.String getSiteId()
          Deprecated. Don't use this, this is the old notion of site (as in Site == Cluster)
 java.lang.Integer getSleepTimeMs()
          Returns the amount of time, in ms, that the engine should sleep upon receiving this call.
 java.lang.String getTargetType()
          gets the target type for the request, e.g.
 java.lang.Integer getTimeLimitMs()
          Returns the time limit in ms for the engine to complete its processing.
 java.lang.String getUserAgent()
          Returns the user-agent string, if one was provided, or null
 java.lang.String getVersion()
          Optional version string for the request type.
 boolean isCacheable()
          If cacheable is false, no attempt will be made to satisfy this request from cached data, nor will the results of this request be added to the cache.

Will also return false if test-oriented values are set.

 boolean isDecodeOnly()
          Indicates whether the response from the request should only be decoded, not parsed
 boolean isGeneratingXml()
           
 boolean isKeepingXml()
          RoutingSearchService (in Routing) will provide the full XML in both the original encoded form and the decoded form, along with individual partition responses, if this is enabled.
 boolean isListPropertyAllowed()
          If true, expect Lists from the Result's properties HashMap.
 boolean isLocalMergeDebugEnabled()
          Results in two requests being sent: one with Java merge, one without.
 boolean isLocalMergeDebugReady()
          Indicates whether the local merge debugging comparison is ready.
 boolean isLocalMergeEnabled()
          Indicates whether local merge is enabled for this request.
 boolean isMultiPartitionSearch()
          Indicates whether this is a multi-partition search.
 boolean isMultiSearchSession()
          Indicates if this request is part of a multi-search session
 boolean isPagingRequest()
          When the request originated in a form handler, this will indicate whether this is a paging request.
 boolean isSaveRequest()
          Indicates whether this will be saved for paging
 SearchResponse merge(java.util.List<SearchResponse> pParsedResponses)
          Invokes local merge on the parsed responses.
 atg.search.routing.command.SearchEngineCommandResponse processResponse(atg.search.routing.command.SearchEngineResponse response)
          Executes and times search response processing.
protected  SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
          Override to provide search response processing (parsing, generally).
 void setAssociatedRequestIdentifier(java.lang.String pAssociatedRequestIdentifier)
          This is typically the identifier for a search request that came before a ViewDocument request.
 void setCacheable(boolean pCacheable)
          If cacheabe is false, no attempt will be made to satisfy this request from cached data, nor will the results of this request be added to the cache.
 void setContentLabels(java.util.List<java.lang.String> pContentLabels)
          sets the List of content labels for the site-specific content to be searched.
 void setContentLabelsArray(java.lang.String[] pContentLabels)
          sets the array of content labels for the site-specific content to be searched.
 void setContentLabelsString(java.lang.String contentLabels)
          accepts a comma-delimited list of contentLabels
 void setDebug(java.lang.Boolean debug)
          Indicates whether debugging should be enabled for this request on the engine
 void setDynamicTargetSpecifier(atg.search.routing.command.search.DynamicTargetSpecifier pDynamicTargetSpecifier)
           
 void setExcludeLogicalPartitionNames(java.util.List pExcludeLogicalPartitionNames)
          Sets the logical partition names to exclude for this request.
 void setGeneratingXml(boolean pGeneratingXml)
           
 void setKeepingXml(boolean pKeepingXml)
          RoutingSearchService (in Routing) will provide the full XML in both the original encoded form and the decoded form, along with individual partition responses, if this is enabled.
 void setLastResponse(SearchResponse pLastResponse)
          Sets the last response for debugging local vs.
 void setListableProperties(java.util.List<java.lang.String> pListableProperties)
          Sets the set of properties that will be stored as lists in the response.
 void setListablePropertiesString(java.lang.String pListablePropertiesString)
           
 void setListPropertyAllowed(boolean listPropertyAllowed)
          Enables storage of multi-valued properties in the Result's properties HashMap.
 void setLocalMergeDebugEnabled(boolean pLocalMergeDebugEnabled)
          Sets whether local merge debugging is enabled for this request
 void setLocalMergeDebugReady(boolean pLocalMergeDebugReady)
          Sets whether local merge debugging comparison is ready for this request
 void setLocalMergeEnabled(boolean pLocalMergeEnabled)
          Controls whether local merge is enabled for this request.
 void setLogicalPartitionNames(java.util.List pLogicalPartitionName)
          Sets the logical partition names for this request.
 void setLogicalPartitionsArray(java.lang.String[] pLogicalPartitions)
          Sets the logical partition names for this request.
 void setMaximumResults(int pMaxResults)
          This is only for JSPs that might want to keep the number of results with the request.
 void setMergeSettings(java.lang.String mergeSettings)
          This is not part of a regular request.
 void setMultiPartitionSearch(boolean multiPartitionSearch)
          Indicates whether this is a multi-partition search.
 void setMultiSearchSession(boolean pMultiSearchSession)
          Call this if you anticipate having multiple, independent form handler searches sharing the same HTTP session.
 void setPagingRequest(boolean pPagingRequest)
          Set this to true to indicate that this is only being used for paging.
 void setPhysicalPartitionId(java.lang.String pPhysicalPartitionId)
          Sets the ID of the physical partition to restrict the search to.
 void setPreviousRequestChainToken(java.lang.String pPreviousRequestChainToken)
          Sets the identifier for the previous chain of requests.
 void setRequestAttribute(java.lang.Object attributeName, java.lang.Object attributeValue)
          provided for compatibility.
 void setRequestAttributes(java.util.Map requestAttributes)
          provided for compatibility.
 void setRequestChainToken(java.lang.String pRequestChainToken)
          Sets a unique identifier for a chain of requests.
 void setRequestIdentifier(java.lang.String pRequestIdentifier)
          This is called automatically by Routing.
 void setRequestTime(long pRequestTime)
          Sets the time of request in milliseconds (as in the time of day).
 void setRespForm(ResponseFormat pRespForm)
          The search engine response format.
 void setSaveRequest(boolean pSaveRequest)
          Causes this request to be saved in session scope for paging purposes.
 void setSearchEnvironmentName(java.lang.String pSearchEnvironmentName)
          Sets the environment target for this request.
 void setSiteConstraints(atg.search.routing.command.search.MultisiteConstraint siteConstraints)
          Sets site constraints
 void setSiteId(java.lang.String pSiteId)
          Deprecated. 
 void setSleepTimeMs(java.lang.Integer pSleepTimeMs)
          Sets the amount of time, in ms, that the engine should sleep upon receiving this call.
 void setTargetType(java.lang.String pTargetType)
          sets the target type for the, e.g.
 void setTimeLimitMs(java.lang.Integer pTimeLimitMs)
          Sets the time limit in ms for the engine to complete its processing.
 void setUserAgent(java.lang.String pUserAgent)
          Sets the optional user agent string.
 void setVersion(java.lang.String version)
          Optional version string for the request type.
static SearchRequest valueOf(java.lang.String pRequestXml)
          An alternative to the subclasses' valueOf methods.
 
Methods inherited from class atg.search.routing.command.SearchEngineRequestImpl
encodeMapData, isFiringSearchEvents, isKeepingResponseData, isLoggingThisRequest, setFiringSearchEvents, setKeepingResponseData, setLoggingThisRequest
 
Methods inherited from class atg.search.routing.command.SearchXMLObject
appendComplexXml, appendOptionalAttr, appendOptionalElem, appendOptionalElem, appendOptionalElem, appendOptionalValue, appendRequiredAttr, appendRequiredElem, appendRequiredElem, appendRequiredValue, getAttributeXML, getBodyXML, getDefaultXmlBytes, getParentXMLObject, getXmlPath, isPrintedFirstChild, setParentXMLObject, setPrintedFirstChild, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface atg.search.routing.command.SearchEngineRequest
toXML
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


EMPTY_ARRAY

protected static java.lang.String[] EMPTY_ARRAY

mTimeLimitMs

protected java.lang.Integer mTimeLimitMs
Time limit in ms before this request times out. Generally some portion of the timeout, say 80%. The engine needs this so it can figure out if it has enough time to answer the request.


mRequestIdentifier

protected java.lang.String mRequestIdentifier
uniquely identifies this request.


mTargets

protected atg.search.routing.SearchTargetNames mTargets
combined object for all search target names--environment, LPs, and excluded LPs


mListPropertyAllowed

protected boolean mListPropertyAllowed
to support list properties in the results.


mListableProperties

protected java.util.List<java.lang.String> mListableProperties
to support specific list properties in the results.


mMultiPartitionSearch

protected boolean mMultiPartitionSearch
indicates a multiple partition search. Set and used by Routing.


mLocalMergeEnabled

protected boolean mLocalMergeEnabled
Controls local merge. If enabled, local merge is used. This is the only property that determines whether local merge is used.


mLocalMergeDebugEnabled

protected boolean mLocalMergeDebugEnabled
Java merge debugging. Submits two requests


mLocalMergeDebugReady

protected boolean mLocalMergeDebugReady
Java merge debugging ready. Means two responses are ready to be compared


mMergeSettings

protected java.lang.String mMergeSettings
response number settings for merge


mVersion

protected java.lang.String mVersion
engine version, not used


mDebug

protected java.lang.Boolean mDebug
engine debugging


mSleepTimeMs

protected java.lang.Integer mSleepTimeMs
forces the engine to go to sleep during the call, for testing timeouts


MsInNs

protected static final double MsInNs
See Also:
Constant Field Values

QUERY

public static final int QUERY
See Also:
Constant Field Values

BROWSE

public static final int BROWSE
See Also:
Constant Field Values

STRUCTQUERY

public static final int STRUCTQUERY
See Also:
Constant Field Values

VIC

public static final int VIC
See Also:
Constant Field Values

SIMILARDOCS

public static final int SIMILARDOCS
See Also:
Constant Field Values

CATEGORIZE

public static final int CATEGORIZE
See Also:
Constant Field Values

INSPECT

public static final int INSPECT
See Also:
Constant Field Values

TREEQUERY

public static final int TREEQUERY
See Also:
Constant Field Values

TYPEAHEAD

public static final int TYPEAHEAD
See Also:
Constant Field Values

TAGS

public static final java.lang.String[] TAGS
XML tags for the different requests.


TIME_LIMIT_MS

protected static final java.lang.String TIME_LIMIT_MS
See Also:
Constant Field Values

RESP_FORM

protected static final java.lang.String RESP_FORM
See Also:
Constant Field Values

VERSION

protected static final java.lang.String VERSION
See Also:
Constant Field Values

MULTI_PARTITION

protected static final java.lang.String MULTI_PARTITION
See Also:
Constant Field Values

DEBUG

protected static final java.lang.String DEBUG
See Also:
Constant Field Values

SLEEP_TIME_MS

protected static final java.lang.String SLEEP_TIME_MS
See Also:
Constant Field Values

ID

protected static final java.lang.String ID
See Also:
Constant Field Values

TIME

protected static final java.lang.String TIME
See Also:
Constant Field Values

LIST_PROPERTY_ALLOWED

protected static final java.lang.String LIST_PROPERTY_ALLOWED
See Also:
Constant Field Values

LISTABLE_PROPERTIES

protected static final java.lang.String LISTABLE_PROPERTIES
See Also:
Constant Field Values

ENV

protected static final java.lang.String ENV
See Also:
Constant Field Values

LOCAL_MERGE

protected static final java.lang.String LOCAL_MERGE
See Also:
Constant Field Values

LOCAL_MERGE_DEBUG

protected static final java.lang.String LOCAL_MERGE_DEBUG
See Also:
Constant Field Values

SAVE_REQUEST

protected static final java.lang.String SAVE_REQUEST
See Also:
Constant Field Values

LOG_THIS_REQUEST

protected static final java.lang.String LOG_THIS_REQUEST
See Also:
Constant Field Values

MULTI_SEARCH_SESSION

protected static final java.lang.String MULTI_SEARCH_SESSION
See Also:
Constant Field Values

CACHEABLE

protected static final java.lang.String CACHEABLE
See Also:
Constant Field Values

SITE_ID

protected static final java.lang.String SITE_ID
See Also:
Constant Field Values

SITE_CONSTR

protected static final java.lang.String SITE_CONSTR
See Also:
Constant Field Values
Constructor Detail

SearchRequest

public SearchRequest()
Method Detail

isDecodeOnly

public boolean isDecodeOnly()
Indicates whether the response from the request should only be decoded, not parsed

Returns:
whether the response from the request should only be decoded, not parsed

getTimeLimitMs

public java.lang.Integer getTimeLimitMs()
Returns the time limit in ms for the engine to complete its processing. Usually some portion of Routing's request timeout, say 80%

Returns:
the time limit in ms for the engine to complete its processing. Usually some portion of Routing's request timeout, say 80%

setTimeLimitMs

public void setTimeLimitMs(java.lang.Integer pTimeLimitMs)
Sets the time limit in ms for the engine to complete its processing. Usually some portion of Routing's request timeout, say 80%

Parameters:
pTimeLimitMs - the time limit in ms for the engine to complete its processing. Usually some portion of Routing's request timeout, say 80%

getRequestTag

public java.lang.String getRequestTag()
Gets the xml element tag used in the request

Specified by:
getRequestTag in interface atg.search.routing.command.SearchEngineRequest
Specified by:
getRequestTag in class atg.search.routing.command.SearchXMLObject
Returns:
xml element tag

getRequestIdentifier

public java.lang.String getRequestIdentifier()
The request id is available after Routing has processed the request.

Returns:
the unique id for this request

setRequestIdentifier

public void setRequestIdentifier(java.lang.String pRequestIdentifier)
This is called automatically by Routing. Replaces underscores with hyphens.

Parameters:
pRequestIdentifier - the unique id for this request

setCacheable

public void setCacheable(boolean pCacheable)
If cacheabe is false, no attempt will be made to satisfy this request from cached data, nor will the results of this request be added to the cache.

Parameters:
pCacheable - pass true to enable caching, false to disable

isCacheable

public boolean isCacheable()
If cacheable is false, no attempt will be made to satisfy this request from cached data, nor will the results of this request be added to the cache.

Will also return false if test-oriented values are set. Specifically, if sleepTimeMs is non-zero.

Returns:
true if caching is enabled

setRequestTime

public void setRequestTime(long pRequestTime)
Sets the time of request in milliseconds (as in the time of day). Set automatically.

Parameters:
pRequestTime - current time in milliseconds

getRequestTime

public long getRequestTime()
The time of day that the request occured, in milliseconds since 1970.

Returns:
time of request in milliseconds

getMaximumResults

public int getMaximumResults()
This is only for JSPs that might want to keep the number of results with the request. It is never part of the request, and is not used by SearchClient, Routing, or the Engine. QueryConsole uses it to generate response number settings that control the number of results.

Returns:
maximum number of results to get

setMaximumResults

public void setMaximumResults(int pMaxResults)
This is only for JSPs that might want to keep the number of results with the request. It is never part of the request, and is not used by SearchClient, Routing, or the Engine. QueryConsole uses it to generate response number settings that control the number of results.

Parameters:
pMaxResults - maximum number of results to display

getUserAgent

public java.lang.String getUserAgent()
Returns the user-agent string, if one was provided, or null

Returns:
user-agent string, if one was provided, or null

setUserAgent

public void setUserAgent(java.lang.String pUserAgent)
Sets the optional user agent string. No search events will be fired when a robot or spider user agent is specified. This is set automatically by the search formhandlers under atg.search.formhandlers. If you are not using one of those formhandlers you must set this property on your own.

Parameters:
pUserAgent - user agent string

isLocalMergeEnabled

public boolean isLocalMergeEnabled()
Indicates whether local merge is enabled for this request. It is enabled by default.

Returns:
whether local merge is enabled for this request

setLocalMergeEnabled

public void setLocalMergeEnabled(boolean pLocalMergeEnabled)
Controls whether local merge is enabled for this request. Enabling this is the only way to enable local merge. It is enabled by default.

Parameters:
pLocalMergeEnabled - whether local merge is enabled for this request

isLocalMergeDebugEnabled

public boolean isLocalMergeDebugEnabled()
Results in two requests being sent: one with Java merge, one without.

Returns:
whether local merge debugging is enabled for this request

setLocalMergeDebugEnabled

public void setLocalMergeDebugEnabled(boolean pLocalMergeDebugEnabled)
Sets whether local merge debugging is enabled for this request

Parameters:
pLocalMergeDebugEnabled - whether local merge debugging is enabled for this request

isLocalMergeDebugReady

public boolean isLocalMergeDebugReady()
Indicates whether the local merge debugging comparison is ready.

Returns:
whether local merge debugging comparison is ready

setLocalMergeDebugReady

public void setLocalMergeDebugReady(boolean pLocalMergeDebugReady)
Sets whether local merge debugging comparison is ready for this request

Parameters:
pLocalMergeDebugReady - whether local merge debugging comparison is ready for this request

isPagingRequest

public boolean isPagingRequest()
When the request originated in a form handler, this will indicate whether this is a paging request. It is not used outside of the formhandler, which means that this is not a reliable indicator outside of that context.

Returns:
true if this is a paging request

setPagingRequest

public void setPagingRequest(boolean pPagingRequest)
Set this to true to indicate that this is only being used for paging. It is false by default. This is normally only used by the search formhandler. Only the pageNum attribute will be preserved when this request is processed; the previous request will be modified with it. See setSaveRequest(boolean).

Parameters:
pPagingRequest - true to indicate that this is a paging request.

isSaveRequest

public boolean isSaveRequest()
Indicates whether this will be saved for paging

Returns:
whether this will be saved for paging

setSaveRequest

public void setSaveRequest(boolean pSaveRequest)
Causes this request to be saved in session scope for paging purposes. If a form handler is not being used, this has no effect.

Parameters:
pSaveRequest - if true, will be saved in session scope by the form handler

isMultiSearchSession

public boolean isMultiSearchSession()
Indicates if this request is part of a multi-search session

Returns:
true if this request is part of a multi-search session

setMultiSearchSession

public void setMultiSearchSession(boolean pMultiSearchSession)
Call this if you anticipate having multiple, independent form handler searches sharing the same HTTP session. This is enabled by default when using the formhandler. When it is enabled, the search session will be linked to a unique request id, retrievable via SearchResponse.getRequestChainToken(); on subsequent searches, you must pass that id to setRequestChainToken(String).

Parameters:
pMultiSearchSession - whether this request will be used in a multi-search session

getSearchTargetNames

public atg.search.routing.SearchTargetNames getSearchTargetNames()
Returns the search target names for this request. Helper methods are provided for accessing the specific targets. See getSearchEnvironmentName(), getLogicalPartitionNames(), getExcludeLogicalPartitionNames(), along with the corresponding setters.

Returns:
the targets for this request

setSearchEnvironmentName

public void setSearchEnvironmentName(java.lang.String pSearchEnvironmentName)
Sets the environment target for this request. Always required.

Parameters:
pSearchEnvironmentName - environment name (not a repository id)

getSearchEnvironmentName

public java.lang.String getSearchEnvironmentName()
Returns the target search environment name, which may be null.

Returns:
search environment name, possibly null

setLogicalPartitionNames

public void setLogicalPartitionNames(java.util.List pLogicalPartitionName)
Sets the logical partition names for this request.

Parameters:
pLogicalPartitionName - List of String

getLogicalPartitionNames

public java.util.List getLogicalPartitionNames()
Returns the List of targeted Logical Partitions' names

Returns:
List of targeted Logical Partitions' names

setLogicalPartitionsArray

public void setLogicalPartitionsArray(java.lang.String[] pLogicalPartitions)
Sets the logical partition names for this request.

Parameters:
pLogicalPartitionName - array of String

getLogicalPartitionsArray

public java.lang.String[] getLogicalPartitionsArray()
Returns array of targeted Logical Partitions' names

Returns:
array of targeted Logical Partitions' names

setExcludeLogicalPartitionNames

public void setExcludeLogicalPartitionNames(java.util.List pExcludeLogicalPartitionNames)
Sets the logical partition names to exclude for this request. All other LPs in the index will be searched

Parameters:
pExcludeLogicalPartitionNames - List of String

getExcludeLogicalPartitionNames

public java.util.List getExcludeLogicalPartitionNames()
Returns the List of excluded Logical Partition names

Returns:
List of excluded Logical Partition names

setPhysicalPartitionId

public void setPhysicalPartitionId(java.lang.String pPhysicalPartitionId)
Sets the ID of the physical partition to restrict the search to. This is for ViewDocumentRequests only, and even in that case never needs to be set by the caller.

Parameters:
pPhysicalPartitionId - ID of physical partition to restrict the search to. This is for ViewDocument requests, and never needs to be set by the caller.

isKeepingXml

public boolean isKeepingXml()
RoutingSearchService (in Routing) will provide the full XML in both the original encoded form and the decoded form, along with individual partition responses, if this is enabled. This will increase the size of the response object by a considerable amount, usually by about 10-20KB (for 10 answers, and depending on the type of response information being returned). Leaving this disabled does not affect Routing's ability to log requests and responses to disk or in Dynamo Admin.

Returns:
whether XML will be included in the response

setKeepingXml

public void setKeepingXml(boolean pKeepingXml)
RoutingSearchService (in Routing) will provide the full XML in both the original encoded form and the decoded form, along with individual partition responses, if this is enabled. This will increase the size of the response object by a considerable amount, usually by about 10-20KB (for 10 answers, and depending on the type of response information being returned). Leaving this disabled does not affect Routing's ability to log requests and responses to disk or in Dynamo Admin.

Parameters:
pKeepingXml - whether XML will be included in the response
See Also:
SearchEngineCommandResponse.getSearchEngineResponse(), SearchEngineResponse.getXmlResponse(), SearchEngineResponse.getXmlResponseDecoded()

isGeneratingXml

public boolean isGeneratingXml()

setGeneratingXml

public void setGeneratingXml(boolean pGeneratingXml)

getAssociatedRequestIdentifier

public java.lang.String getAssociatedRequestIdentifier()
This is typically a search request that came before a ViewDocument request. This would be the value passed to setAssociatedRequestIdentifier(String) on the that request.

Returns:
the associated request identifier

setAssociatedRequestIdentifier

public void setAssociatedRequestIdentifier(java.lang.String pAssociatedRequestIdentifier)
This is typically the identifier for a search request that came before a ViewDocument request. This would be the value passed to setAssociatedRequestIdentifier(String) on the that request.

Parameters:
pAssociatedRequestIdentifier - the associated request's identifier

getSiteId

@Deprecated
public java.lang.String getSiteId()
Deprecated. Don't use this, this is the old notion of site (as in Site == Cluster)

This is a client-side value provided for reporting purposes that identifies the site.

Returns:
site id

setSiteId

@Deprecated
public void setSiteId(java.lang.String pSiteId)
Deprecated. 

This is a client-side value provided for reporting purposes. It should identify the site being searched.

Parameters:
pSiteId - the site being searched.

getSiteConstraints

public atg.search.routing.command.search.MultisiteConstraint getSiteConstraints()
Returns the site constraints. Creates one if it doesn't already exist.

Returns:
site constraints

setSiteConstraints

public void setSiteConstraints(atg.search.routing.command.search.MultisiteConstraint siteConstraints)
Sets site constraints

Parameters:
siteConstraints - site constraints

getRequestId

public abstract int getRequestId()
This identifies the type of request, one of QUERY, BROWSE, etc.

Returns:
one of the request constants defined by this class

getVersion

public java.lang.String getVersion()
Optional version string for the request type.

Returns:
version string for the request type

setVersion

public void setVersion(java.lang.String version)
Optional version string for the request type.

Parameters:
version - version string

getDebug

public java.lang.Boolean getDebug()
Indicates whether debugging should be enabled for this request on the engine

Returns:
whether debugging should be enabled in the engine

setDebug

public void setDebug(java.lang.Boolean debug)
Indicates whether debugging should be enabled for this request on the engine

Parameters:
debug - whether debugging should be enabled in the engine

getSleepTimeMs

public java.lang.Integer getSleepTimeMs()
Returns the amount of time, in ms, that the engine should sleep upon receiving this call. This is meant for testing timeouts and retries on the client side.

Returns:
the amount of time, in ms, that the engine should sleep upon receiving this call, or null

setSleepTimeMs

public void setSleepTimeMs(java.lang.Integer pSleepTimeMs)
Sets the amount of time, in ms, that the engine should sleep upon receiving this call. This is meant for testing timeouts and retries on the client side. The engine will go to sleep immediately--for the specified period--upon encountering this request attribute. For example, suppose the particular request normally takes 50ms; if the same request is sent with sleepTimeMs=30000, the request will take approximately 30050ms. If the readTimeout in Routing (see Configuration.getReadTimeoutMs()) is 20000ms, then the call will timeout.

Parameters:
pSleepTimeMs - the amount of time, in ms, that the engine should sleep upon receiving this call

getRequestAttributes

public java.util.Map getRequestAttributes()
provided for compatibility, but a no-op, and returns null.

Specified by:
getRequestAttributes in interface atg.search.routing.command.SearchEngineRequest
Overrides:
getRequestAttributes in class atg.search.routing.command.SearchEngineRequestImpl
Returns:
null

getRequestAttribute

public java.lang.String getRequestAttribute(java.lang.Object attributeName)
provided for compatibility. A no-op, and returns null

Specified by:
getRequestAttribute in interface atg.search.routing.command.SearchEngineRequest
Overrides:
getRequestAttribute in class atg.search.routing.command.SearchEngineRequestImpl
Parameters:
attributeName -
Returns:
null

setRequestAttributes

public void setRequestAttributes(java.util.Map requestAttributes)
provided for compatibility. A no-op.

Specified by:
setRequestAttributes in interface atg.search.routing.command.SearchEngineRequest
Overrides:
setRequestAttributes in class atg.search.routing.command.SearchEngineRequestImpl
Parameters:
requestAttributes -

setRequestAttribute

public void setRequestAttribute(java.lang.Object attributeName,
                                java.lang.Object attributeValue)
provided for compatibility. A no-op

Specified by:
setRequestAttribute in interface atg.search.routing.command.SearchEngineRequest
Overrides:
setRequestAttribute in class atg.search.routing.command.SearchEngineRequestImpl
Parameters:
attributeName -
attributeValue -

getMergeSettings

public java.lang.String getMergeSettings()
This is not part of a regular request. Merge settings to be used by Roouting for the merge request

Returns:
merge settings

setMergeSettings

public void setMergeSettings(java.lang.String mergeSettings)
This is not part of a regular request. Merge settings to be used by Roouting for the merge request. Provide this value if you do not want Routing to use the original request's respons enumber settings.

Parameters:
mergeSettings - merge settings

isMultiPartitionSearch

public boolean isMultiPartitionSearch()
Indicates whether this is a multi-partition search. This is set automatically.

Returns:
true if this is for multiple partitions

setMultiPartitionSearch

public void setMultiPartitionSearch(boolean multiPartitionSearch)
Indicates whether this is a multi-partition search. This is set automatically.

Parameters:
multiPartitionSearch - whether this is for multiple partitions

isListPropertyAllowed

public boolean isListPropertyAllowed()
If true, expect Lists from the Result's properties HashMap. Otherwise expect Strings. False by default.

Returns:
whether list properties are allowed

setListPropertyAllowed

public void setListPropertyAllowed(boolean listPropertyAllowed)
Enables storage of multi-valued properties in the Result's properties HashMap. All values will be Lists, whether or not they are multi-valued. Default is false.

Parameters:
listPropertyAllowed - true to enable list properties

getTargetType

public java.lang.String getTargetType()
gets the target type for the request, e.g. "production" or "staging"

Returns:
the target type name

setTargetType

public void setTargetType(java.lang.String pTargetType)
sets the target type for the, e.g. "production" or "staging", which will help tell routing which search environment to use

Parameters:
pTargetType - the target type name

getContentLabels

public java.util.List<java.lang.String> getContentLabels()
returns the content label(s) for this request, which indicate site-specific content to be searched

Returns:
List of content label strings

setContentLabels

public void setContentLabels(java.util.List<java.lang.String> pContentLabels)
sets the List of content labels for the site-specific content to be searched.

Parameters:
pContentLabels -

setContentLabelsArray

public void setContentLabelsArray(java.lang.String[] pContentLabels)
sets the array of content labels for the site-specific content to be searched.

Parameters:
pContentLabels - - array of content labels

getContentLabelsArray

public java.lang.String[] getContentLabelsArray()
Returns the content label(s) for this request, which indicate site-specific content to be searched

Returns:
an array of content label strings

setContentLabelsString

public void setContentLabelsString(java.lang.String contentLabels)
accepts a comma-delimited list of contentLabels

Parameters:
contentLabels -
See Also:
#setContentLabels(List)

getDynamicTargetSpecifier

public atg.search.routing.command.search.DynamicTargetSpecifier getDynamicTargetSpecifier()

setDynamicTargetSpecifier

public void setDynamicTargetSpecifier(atg.search.routing.command.search.DynamicTargetSpecifier pDynamicTargetSpecifier)

fillDynamicTargetSpecifier

public void fillDynamicTargetSpecifier()

fillDynamicTargets

public void fillDynamicTargets(atg.search.routing.command.search.DynamicTarget msTarget)

getListableProperties

public java.util.List<java.lang.String> getListableProperties()
Returns the set of properties that will be stored as lists in the response. In contrast to setListPropertyAllowed(boolean), this controls individual properties. Leave the other property set to false, and include in this set all properties that should be lists. Only these properties will be represented by lists in the results.

Returns:
comma-delimited list of properties that will be stored as lists in the response

getListablePropertiesString

public java.lang.String getListablePropertiesString()

setListableProperties

public void setListableProperties(java.util.List<java.lang.String> pListableProperties)
Sets the set of properties that will be stored as lists in the response. In contrast to #setListPropertyAllowed(), this controls individual properties. Leave the other property set to false, and include in this set all properties that should be lists. Only these properties will be represented by lists in the results.

Parameters:
pListableProperties - comma-delimited list of properties that will be stored as lists in the response

setListablePropertiesString

public void setListablePropertiesString(java.lang.String pListablePropertiesString)
Parameters:
pListablePropertiesString - comma-delimited list of properties that will be stored as lists in the response

getAllAttributeXML

protected final void getAllAttributeXML(java.lang.StringBuilder cmd)
                                 throws atg.search.routing.command.IncompleteCommandException
Inserts attributes for all commands. Any attribute added here should also be extracted in fromXml(atg.search.routing.utils.SearchMessageNode). Fills the provided buffer with the complete attribute XML for the command.

Overrides:
getAllAttributeXML in class atg.search.routing.command.SearchXMLObject
Throws:
atg.search.routing.command.IncompleteCommandException

getAllBodyXML

protected void getAllBodyXML(java.lang.StringBuilder sb)
                      throws atg.search.routing.command.IncompleteCommandException
Overrides:
getAllBodyXML in class atg.search.routing.command.SearchXMLObject
Throws:
atg.search.routing.command.IncompleteCommandException

fromXml

protected final void fromXml(atg.search.routing.utils.SearchMessageNode pXml)
populates common attributes from xml. This should be called at the top of each request type's fromXml method. See, for example, QueryRequest#fromXml(atg.search.routing.utils.SearchMessageParser). These should be the same attributes inserted into the outbound XML in getAllAttributeXML(StringBuilder).

Parameters:
pXml - parsed node

processSearchResponse

protected SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
                                        throws atg.search.routing.command.RoutingCommandException
Override to provide search response processing (parsing, generally). Returns null by default.

Parameters:
response - the engine response
Returns:
null by default
Throws:
atg.search.routing.command.RoutingCommandException
See Also:
processResponse(atg.search.routing.command.SearchEngineResponse)

processResponse

public final atg.search.routing.command.SearchEngineCommandResponse processResponse(atg.search.routing.command.SearchEngineResponse response)
                                                                             throws atg.search.routing.command.RoutingCommandException
Executes and times search response processing.

Specified by:
processResponse in interface atg.search.routing.command.SearchEngineRequest
Overrides:
processResponse in class atg.search.routing.command.SearchEngineRequestImpl
Parameters:
response - the response from the engine
Returns:
null or a command-specific subclass of SearchEngineCommandResponse
Throws:
atg.search.routing.command.RoutingCommandException

doMerge

protected SearchResponse doMerge(java.util.List<SearchResponse> pParsedResponses)
                          throws atg.search.routing.MergeException
Default implementation returns the first element of the array and tosses the rest. Subclasses must provide their own implementations.

Parameters:
pParsedResponses - parsed responses
Returns:
the first, or the merged response if the subclass overrides this
Throws:
atg.search.routing.MergeException

merge

public final SearchResponse merge(java.util.List<SearchResponse> pParsedResponses)
                           throws atg.search.routing.MergeException
Invokes local merge on the parsed responses.

Parameters:
pParsedResponses - parsed responses
Returns:
the first, or the merged response if the subclass overrides this
Throws:
atg.search.routing.MergeException

setRequestChainToken

public void setRequestChainToken(java.lang.String pRequestChainToken)
Sets a unique identifier for a chain of requests. Required for multiple search sessions per single user HTTP session in the form handler. This should be set on paging requests using SearchResponse.getRequestChainToken(). See setPreviousRequestChainToken(String), which must be called on search requests.

Parameters:
pRequestChainToken - unique identifier, often the requestIdentifier from the first response in the chain.

getRequestChainToken

public java.lang.String getRequestChainToken()
a unique identifier for a chain of requests. Used for multiple search sessions per single user HTTP session in the form handler.

Returns:
unique identifier for the chain

getPreviousRequestChainToken

public java.lang.String getPreviousRequestChainToken()
Returns the identifier for the previous chain of requests. Called internally, but see setRequestChainToken(String) and setPreviousRequestChainToken(String). When available, this value is used internally to clear out the old request chain data when a new request chain begins.

Returns:
identifier for the previous request chain

setPreviousRequestChainToken

public void setPreviousRequestChainToken(java.lang.String pPreviousRequestChainToken)
Sets the identifier for the previous chain of requests. This is required whenever setRequestChainToken(String) is used, as the previous token provides the only means of cleaning up old request chain data once a new request chain is started. Example: User asks a question and pages through a few pages. Then the user types in a new question and clicks Search. The initial request establishes the request chain, and the subsequent paging requests associate data with it. The new question establishes a new request chain. The old request chain data will remain in the session unless it is cleared, but it can only be accessed with the old token. Thus, the best practice is to examine the search response at the top of your search page: if you have one, then set previousRequestChainToken using the value; if you do not have a response, then there is nothing to set. This ensures that the next request, if it happens to be a new request and not merely a paging or faceted navigation request, will clear out the old request data.

Parameters:
pPreviousRequestChainToken - unique identifier, often the requestIdentifier from the first response in the chain.

setLastResponse

public void setLastResponse(SearchResponse pLastResponse)
Sets the last response for debugging local vs. non-local merge results. This is only used internally. It is automatically called when isLocalMergeDebugEnabled() is true.

Parameters:
pLastResponse - the last response

getLastResponse

public SearchResponse getLastResponse()
Returns the last response. This is only used for debugging differences between local and non-local merge. This is only used internally.

Returns:
the last response

getRespForm

public ResponseFormat getRespForm()
The search engine response format. Either ResponseFormat.COMP when using compressed search engine responses, or ResponseFormat.NORM for "normal" (uncompressed) responses.

Returns:
the request format

setRespForm

public void setRespForm(ResponseFormat pRespForm)
The search engine response format. Either ResponseFormat.COMP when using compressed search engine responses, or ResponseFormat.NORM for "normal" (uncompressed) responses.

Parameters:
pRespForm - the request format

valueOf

public static SearchRequest valueOf(java.lang.String pRequestXml)
An alternative to the subclasses' valueOf methods. This method does not require the caller to know the type of the request. The return value can be used directly in calls to SearchClient. This method does not support inspect requests. Unsupported request types result in a null return value.

Parameters:
pRequestXml - request xml
Returns:
the request, or null if the input is bad or not supported