atg.search.routing.command.search
Class TypeAheadRequest

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
              extended by atg.search.routing.command.search.TypeAheadRequest
All Implemented Interfaces:
atg.search.routing.command.SearchEngineRequest, java.io.Serializable

public class TypeAheadRequest
extends SearchRequest

This class is used to issue Type Ahead requests to the engine. For a given (user-entered) string, and a language specified in the request, the engine returns a collection of strings representing suggested completions for the string, if any

See Also:
Serialized Form

Nested Class Summary
static class TypeAheadRequest.Response
          Response class for the TypeAheadRequest class
 
Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.search.routing.command.search.SearchRequest
BROWSE, CACHEABLE, CATEGORIZE, DEBUG, EMPTY_ARRAY, ENV, ID, INSPECT, LIST_PROPERTY_ALLOWED, LISTABLE_PROPERTIES, LOCAL_MERGE, LOCAL_MERGE_DEBUG, LOG_THIS_REQUEST, mDebug, mListableProperties, mListPropertyAllowed, mLocalMergeDebugEnabled, mLocalMergeDebugReady, mLocalMergeEnabled, mMergeSettings, mMultiPartitionSearch, mRequestIdentifier, MsInNs, mSleepTimeMs, mTargets, mTimeLimitMs, MULTI_PARTITION, MULTI_SEARCH_SESSION, mVersion, QUERY, RESP_FORM, SAVE_REQUEST, SIMILARDOCS, SITE_CONSTR, SITE_ID, SLEEP_TIME_MS, STRUCTQUERY, TAGS, TIME, TIME_LIMIT_MS, TREEQUERY, TYPEAHEAD, VERSION, VIC
 
Constructor Summary
TypeAheadRequest()
           
 
Method Summary
protected  SearchResponse doMerge(java.util.List<SearchResponse> pParsedResponses)
          Default implementation returns the first element of the array and tosses the rest.
protected static TypeAheadRequest fromXml(atg.search.routing.utils.SearchMessageParser xml)
           
protected  void getAttributeXML(java.lang.StringBuilder sb)
           
protected  void getBodyXML(java.lang.StringBuilder sb)
           
 java.lang.String getLanguage()
          Get the name of the language to be used in the request.
 java.lang.String getName()
          Returns the optional name associated with this request.
 int getRequestId()
          This identifies the type of request, one of SearchRequest.QUERY, SearchRequest.BROWSE, etc.
 TypeAheadSortType getSort()
          The kind of sorting the engine should perform on the results.
 java.lang.String getSortOrder()
          Get the currently set sort order.
 java.lang.String getText()
           
 boolean isLocalMergeEnabled()
          Indicates whether local merge is enabled for this request.
 SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
          Override to provide search response processing (parsing, generally).
 void setLanguage(java.lang.String language)
          Set the language to be used in the request.
 void setName(java.lang.String name)
          Sets the name attribute of this request.
 void setSort(TypeAheadSortType sort)
          Set the kind of sorting the engine should perform on the results.
 void setSortOrder(java.lang.String sortOrder)
          Set the sort order.
 void setText(java.lang.String text)
          Set the text of the request, which is the text string for which completion suggestions are returned
static TypeAheadRequest valueOf(java.lang.String pRequestXml)
          Convert request xml into a TypeAheadRequest object.
 
Methods inherited from class atg.search.routing.command.search.SearchRequest
fillDynamicTargets, fillDynamicTargetSpecifier, fromXml, getAllAttributeXML, getAllBodyXML, getAssociatedRequestIdentifier, getContentLabels, getContentLabelsArray, getDebug, getDynamicTargetSpecifier, getExcludeLogicalPartitionNames, getLastResponse, getListableProperties, getListablePropertiesString, getLogicalPartitionNames, getLogicalPartitionsArray, getMaximumResults, getMergeSettings, getPreviousRequestChainToken, getRequestAttribute, getRequestAttributes, getRequestChainToken, getRequestIdentifier, getRequestTag, getRequestTime, getRespForm, getSearchEnvironmentName, getSearchTargetNames, getSiteConstraints, getSiteId, getSleepTimeMs, getTargetType, getTimeLimitMs, getUserAgent, getVersion, isCacheable, isDecodeOnly, isGeneratingXml, isKeepingXml, isListPropertyAllowed, isLocalMergeDebugEnabled, isLocalMergeDebugReady, isMultiPartitionSearch, isMultiSearchSession, isPagingRequest, isSaveRequest, merge, processResponse, setAssociatedRequestIdentifier, setCacheable, setContentLabels, setContentLabelsArray, setContentLabelsString, setDebug, setDynamicTargetSpecifier, setExcludeLogicalPartitionNames, setGeneratingXml, setKeepingXml, setLastResponse, setListableProperties, setListablePropertiesString, setListPropertyAllowed, setLocalMergeDebugEnabled, setLocalMergeDebugReady, setLocalMergeEnabled, setLogicalPartitionNames, setLogicalPartitionsArray, setMaximumResults, setMergeSettings, setMultiPartitionSearch, setMultiSearchSession, setPagingRequest, setPhysicalPartitionId, setPreviousRequestChainToken, setRequestAttribute, setRequestAttributes, setRequestChainToken, setRequestIdentifier, setRequestTime, setRespForm, setSaveRequest, setSearchEnvironmentName, setSiteConstraints, setSiteId, setSleepTimeMs, setTargetType, setTimeLimitMs, setUserAgent, setVersion
 
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, 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
Constructor Detail

TypeAheadRequest

public TypeAheadRequest()
Method Detail

getText

public java.lang.String getText()
Returns:
the text of the request, which is the text string for which completion suggestions are returned

setText

public void setText(java.lang.String text)
Set the text of the request, which is the text string for which completion suggestions are returned

Parameters:
text - The string to be matched in the request.

isLocalMergeEnabled

public boolean isLocalMergeEnabled()
Description copied from class: SearchRequest
Indicates whether local merge is enabled for this request. It is enabled by default.

Overrides:
isLocalMergeEnabled in class SearchRequest
Returns:
whether local merge is enabled for this request

getSort

public TypeAheadSortType getSort()
The kind of sorting the engine should perform on the results. See TypeAheadSortType

Returns:
the currently set sort type

setSort

public void setSort(TypeAheadSortType sort)
Set the kind of sorting the engine should perform on the results. See TypeAheadSortType

Parameters:
sort - the sort value to set

getSortOrder

public java.lang.String getSortOrder()
Get the currently set sort order. This value can be either "ascending" or "descending". This value indicates the overall sort order of the results. The value of getSort() indicates the kind of sorting to perform. This value indicates whether that sorting is then rendered in ascending or descending fashion.

Returns:
the current sorting value, either "ascending" or "descending"

setSortOrder

public void setSortOrder(java.lang.String sortOrder)
Set the sort order.

Parameters:
sortOrder - This value can be either "ascending" or "descending". This value indicates the overall sort order of the results. The value of getSort() indicates the kind of sorting to perform. This value indicates whether that sorting is then rendered in ascending or descending fashion. "descending" is the default value.

getLanguage

public java.lang.String getLanguage()
Get the name of the language to be used in the request.

Returns:
the language name

setLanguage

public void setLanguage(java.lang.String language)
Set the language to be used in the request. This request is language specific and a language value must be specified. Only results for the given language will be returned. Data for Type Ahead requests in the search engine index are tagged by their language and results are constrained to the given language. Note that the language must be present in the index, or an error is returned from the search engine.

Parameters:
language - the name of the language to be used. See available languages at Language

getName

public java.lang.String getName()
Returns the optional name associated with this request. The name string can be used to select specific typeahead data to be used in this request, if the typeahead data in the index was loaded with name attributes.

Returns:
the name set on the request, if any

setName

public void setName(java.lang.String name)
Sets the name attribute of this request. This will constrain the typeahead data used by the search engine to process this request to the typeahead data loaded with the same name attribute. The name attribute can be used to partition the typeahead data (e.g. by site), and setting this value on the request tells the engine to use that typehead data specifically.

Parameters:
name - the name of the typeahead data to use in this request

getAttributeXML

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

getBodyXML

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

getRequestId

public int getRequestId()
Description copied from class: SearchRequest
This identifies the type of request, one of SearchRequest.QUERY, SearchRequest.BROWSE, etc.

Specified by:
getRequestId in class SearchRequest
Returns:
the constant request id for this type of request. This is NOT a query id that identifies each user request.

doMerge

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

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

processSearchResponse

public SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
                                     throws atg.search.routing.command.RoutingCommandException
Description copied from class: SearchRequest
Override to provide search response processing (parsing, generally). Returns null by default.

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

valueOf

public static TypeAheadRequest valueOf(java.lang.String pRequestXml)
Convert request xml into a TypeAheadRequest object.

Parameters:
pRequestXml - the request xml
Returns:
a TypeAheadRequest object constructed from the request xml

fromXml

protected static TypeAheadRequest fromXml(atg.search.routing.utils.SearchMessageParser xml)