atg.search.routing.command.search
Class TreeQueryRequest

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

public class TreeQueryRequest
extends SearchRequest
implements PagedRequest

Tree query request. This query is not cacheable, and only supports local merge.

Required: Fields

Optional: Everything else

See Also:
Serialized Form

Nested Class Summary
static class TreeQueryRequest.DocSortOrder
          Sort order of resulting groups.
static class TreeQueryRequest.Response
          TreeQueryRequest Response type
 
Field Summary
static java.lang.String CLASS_VERSION
           
protected static Field[] EMPTY_FIELD_ARRAY
           
 
Fields inherited from class atg.search.routing.command.search.SearchRequest
BROWSE, CACHEABLE, CATEGORIZE, 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
 
Fields inherited from interface atg.search.routing.command.search.PagedRequest
ORIG_PAGE_SIZE, PAGE_NUM, PAGE_OFFSET_INFO, PAGE_SIZE
 
Constructor Summary
TreeQueryRequest()
           
 
Method Summary
 SearchResponse doMerge(java.util.List<SearchResponse> pParsedResponses)
          Executes the merge.
protected static TreeQueryRequest fromXml(atg.search.routing.utils.SearchMessageParser xml, SearchRequest compRequest)
           
protected  void getAttributeXML(java.lang.StringBuilder buf)
           
protected  void getBodyXML(java.lang.StringBuilder buf)
           
 java.lang.String[] getDocProps()
          list of docprops
 java.lang.String getDocPropsString()
          returns a comma-delimited list of docprops.
 atg.search.routing.command.search.DocSortCommon getDocSort()
          ATG Search returns a list of result groups in its response.
 TreeQueryRequest.DocSortOrder getDocSortOrder()
          Returns whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.
 java.lang.String getDocSortProp()
          the property name to use for the strprop or intprop or floatprop modes
 java.lang.String getDocSortPropDefault()
          doc sort property default
 java.lang.Boolean getFastPaging()
          Fast paging never returns more than is required for a given page.
 Field[] getFields()
          Returns a non-null, but possibly empty, array of fields.
 Field getFields(int pIndex)
          Indexed getter that can be called for any index, even if out of bounds.
 java.lang.Integer getMaxFilter()
          Returns the maximum number of results that the engine will consider.
 java.lang.Integer getMaxResults()
          Maximum number of results to return
 java.lang.Integer getPageNum()
          The page number being requested, starting at 0.
 atg.search.routing.command.search.PageOffsetInfo getPageOffsetInfo()
          Returns the page offset information.
 java.lang.Integer getPageSize()
          Returns the max number of results that should appear on a page
 int getRequestId()
          the constant request id for this type of request.
 boolean isLocalMergeEnabled()
          This method always returns true for this type of request
 SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
          processes the search engine response.
 void setDocProps(java.lang.String[] docProps)
          ATG Search returns the meta-data properties associated with the index item of each statement result.
 void setDocPropsString(java.lang.String docProps)
          accepts a comma-delimited list of docProps
 void setDocSort(atg.search.routing.command.search.DocSortCommon pDocSort)
          ATG Search returns a list of result groups in its response.
 void setDocSortOrder(TreeQueryRequest.DocSortOrder docSortOrder)
          Sets whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.
 void setDocSortProp(java.lang.String docSortProp)
          Index items that don't have this property will be excluded from the sort.
 void setDocSortPropDefault(java.lang.String docSortPropDefault)
          the default property value to use when the property is missing.
 void setFastPaging(java.lang.Boolean pFastPaging)
          Fast paging never returns more than is required for a given page.
 void setFields(Field[] pFields)
          Sets the fields for the request
 void setFields(int pIndex, Field pStatement)
          Indexed setter that automatically grows the underlying array for any index value.
 void setMaxFilter(java.lang.Integer pMaxFilter)
          Controls the maximum number of results that the engine will consider.
 void setMaxResults(java.lang.Integer pMaxResults)
          Sets the maximum number of results to return
 void setPageNum(java.lang.Integer pageNum)
          For efficiency, most search sites return results a page at a time, forcing the end-user to request additional results if necessary.
 void setPageOffsetInfo(atg.search.routing.command.search.PageOffsetInfo pPageOffsetInfo)
          Sets the page offset information.
 void setPageSize(java.lang.Integer pageSize)
          For efficiency, most search sites return results a page at a time, forcing the end-user to request additional results if necessary.
static TreeQueryRequest valueOf(java.lang.String pRequestXml)
          Converts XML into a QueryRequest
static TreeQueryRequest valueOf(java.lang.String pRequestXml, SearchRequest compRequest)
          Converts an xml string into a TreeQueryRequest
 
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

EMPTY_FIELD_ARRAY

protected static Field[] EMPTY_FIELD_ARRAY
Constructor Detail

TreeQueryRequest

public TreeQueryRequest()
Method Detail

isLocalMergeEnabled

public boolean isLocalMergeEnabled()
This method always returns true for this type of request

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

getFields

public Field[] getFields()
Returns a non-null, but possibly empty, array of fields.

Returns:
non-null array of fields
See Also:
getFields(int)

setFields

public void setFields(Field[] pFields)
Sets the fields for the request

Parameters:
pFields - array of fields
See Also:
setFields(int, Field)

setFields

public void setFields(int pIndex,
                      Field pStatement)
Indexed setter that automatically grows the underlying array for any index value. Intervening elements will be null.

Parameters:
pStatement - a statement

getFields

public Field getFields(int pIndex)
Indexed getter that can be called for any index, even if out of bounds. An out of bounds index will insert a new Field at the specified location, growing the underlying array if necessary

Parameters:
pIndex -
Returns:
a field

setMaxResults

public void setMaxResults(java.lang.Integer pMaxResults)
Sets the maximum number of results to return

Parameters:
pMaxResults - maximum number of results to return

getMaxResults

public java.lang.Integer getMaxResults()
Maximum number of results to return

Returns:
maximum number of results to return

getAttributeXML

protected void getAttributeXML(java.lang.StringBuilder buf)
                        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 buf)
                   throws atg.search.routing.command.IncompleteCommandException
Overrides:
getBodyXML in class atg.search.routing.command.SearchXMLObject
Throws:
atg.search.routing.command.IncompleteCommandException

valueOf

public static TreeQueryRequest valueOf(java.lang.String pRequestXml)
Converts XML into a QueryRequest

Parameters:
pRequestXml - query request XML
Returns:
a QueryRequest populated from the XML, or null if the XML is null;

valueOf

public static TreeQueryRequest valueOf(java.lang.String pRequestXml,
                                       SearchRequest compRequest)
Converts an xml string into a TreeQueryRequest

Parameters:
pRequestXml - TreeQuery xml
compRequest - an existing (TreeQuery) request object to combine with the provide xml, typically initalized as a nucleus component
Returns:
a TreeQuery request, or null if the string is empty

fromXml

protected static TreeQueryRequest fromXml(atg.search.routing.utils.SearchMessageParser xml,
                                          SearchRequest compRequest)

getMaxFilter

public java.lang.Integer getMaxFilter()
Returns the maximum number of results that the engine will consider. This number is always larger than maxResults. It helps scalability by limiting the number of candidate results.

Returns:
max filter

setMaxFilter

public void setMaxFilter(java.lang.Integer pMaxFilter)
Controls the maximum number of results that the engine will consider. This number is always larger than maxResults. It helps scalability by limiting the number of candidate results.

Parameters:
pMaxFilter - max filter

getDocSort

public atg.search.routing.command.search.DocSortCommon getDocSort()
ATG Search returns a list of result groups in its response. These final results are pulled from the pool of raw results. Normally, the result groups are sorted in relevance order, but user interfaces often allow the final results to be sorted by some secondary criteria, such as a property. This secondary sort does not affect what results are in the final result groups, just the order of the returned groups. Secondary sorting is performed before paging. Secondary sorting is controlled by setDocSort(atg.search.routing.command.search.DocSortCommon), setDocSortOrder(atg.search.routing.command.search.TreeQueryRequest.DocSortOrder), setDocSortProp(java.lang.String), setDocSortPropDefault(java.lang.String).

Returns:
doc sort

setDocSort

public void setDocSort(atg.search.routing.command.search.DocSortCommon pDocSort)
ATG Search returns a list of result groups in its response. These final results are pulled from the pool of raw results. Normally, the result groups are sorted in relevance order, but user interfaces often allow the final results to be sorted by some secondary criteria, such as a property. This secondary sort does not affect what results are in the final result groups, just the order of the returned groups. Secondary sorting is performed before paging. Secondary sorting is controlled by setDocSort(atg.search.routing.command.search.DocSortCommon), setDocSortOrder(atg.search.routing.command.search.TreeQueryRequest.DocSortOrder), setDocSortProp(java.lang.String), setDocSortPropDefault(java.lang.String).

Parameters:
pDocSort - doc sort

getDocProps

public java.lang.String[] getDocProps()
list of docprops

Returns:
docProps
See Also:
setDocProps(String[])

setDocProps

public void setDocProps(java.lang.String[] docProps)
ATG Search returns the meta-data properties associated with the index item of each statement result. These returned properties can be used for user interface functionality, such as customized result pages. By default, ATG Search returns no properties.

Parameters:
docProps - Can be "all", which indicates that all properties are returned. By default no properties are returned. In general, it is a list of the property names that can be returned.

setDocPropsString

public void setDocPropsString(java.lang.String docProps)
accepts a comma-delimited list of docProps

Parameters:
docProps - comma-delimited list of docprops
See Also:
setDocProps(String[])

getDocPropsString

public java.lang.String getDocPropsString()
returns a comma-delimited list of docprops.

Returns:
comma-delimited list of docprops.
See Also:
getDocProps()

getDocSortOrder

public TreeQueryRequest.DocSortOrder getDocSortOrder()
Returns whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.

Returns:
whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.

setDocSortOrder

public void setDocSortOrder(TreeQueryRequest.DocSortOrder docSortOrder)
Sets whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.

Parameters:
docSortOrder - determines whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode.

getDocSortProp

public java.lang.String getDocSortProp()
the property name to use for the strprop or intprop or floatprop modes

Returns:
the property name to use for the strprop or intprop or floatprop modes

setDocSortProp

public void setDocSortProp(java.lang.String docSortProp)
Index items that don't have this property will be excluded from the sort. To prevent that, setDocSortPropDefault(java.lang.String) can specify the default property value to use for these exceptional cases. The default value should agree with the type of the property.

Parameters:
docSortProp - specifies the property name to use for the strprop or intprop or floatprop modes.

getDocSortPropDefault

public java.lang.String getDocSortPropDefault()
doc sort property default

Returns:
the property name to use for the strprop or intprop or floatprop modes.

setDocSortPropDefault

public void setDocSortPropDefault(java.lang.String docSortPropDefault)
the default property value to use when the property is missing. The default value should agree with the type of the property.

Parameters:
docSortPropDefault - the default property value to use when the property is missing.

setPageOffsetInfo

public void setPageOffsetInfo(atg.search.routing.command.search.PageOffsetInfo pPageOffsetInfo)
Sets the page offset information. Used internally by merge.

Specified by:
setPageOffsetInfo in interface PagedRequest
Parameters:
pPageOffsetInfo - page offset information

getPageOffsetInfo

public atg.search.routing.command.search.PageOffsetInfo getPageOffsetInfo()
Returns the page offset information. Used internally by merge.

Specified by:
getPageOffsetInfo in interface PagedRequest
Returns:
page offset information

getFastPaging

public java.lang.Boolean getFastPaging()
Fast paging never returns more than is required for a given page. The trade-off is that for large multi-partition indexes you lose jump-to-page functionality. It is disabled by default

Specified by:
getFastPaging in interface PagedRequest
Returns:
false by default

setFastPaging

public void setFastPaging(java.lang.Boolean pFastPaging)
Fast paging never returns more than is required for a given page. The trade-off is that for large multi-partition indexes you lose jump-to-page functionality. It is disabled by default

Specified by:
setFastPaging in interface PagedRequest
Parameters:
pFastPaging - true to enable fast paging

getPageSize

public java.lang.Integer getPageSize()
Returns the max number of results that should appear on a page

Specified by:
getPageSize in interface PagedRequest
Returns:
number of results on a page

setPageSize

public void setPageSize(java.lang.Integer pageSize)
For efficiency, most search sites return results a page at a time, forcing the end-user to request additional results if necessary. ATG Search supports result paging, and it is controlled by pageNum and pageSize.

Specified by:
setPageSize in interface PagedRequest
Parameters:
pageSize - specifies the size of the page

getPageNum

public java.lang.Integer getPageNum()
The page number being requested, starting at 0.

Specified by:
getPageNum in interface PagedRequest
Returns:
which page number to return, starting from the first page 0 and so on.

setPageNum

public void setPageNum(java.lang.Integer pageNum)
For efficiency, most search sites return results a page at a time, forcing the end-user to request additional results if necessary. ATG Search supports result paging, and it is controlled by these attributes: setPageNum(Integer) and setPageSize(Integer).

Specified by:
setPageNum in interface PagedRequest
Parameters:
pageNum - specifies which page number to return, starting from the first page 0 and so on.

getRequestId

public int getRequestId()
the constant request id for this type of request.

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.

processSearchResponse

public SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
                                     throws atg.search.routing.command.RoutingCommandException
processes the search engine response. Used internally.

Overrides:
processSearchResponse in class SearchRequest
Parameters:
response -
Returns:
processed response
Throws:
atg.search.routing.command.RoutingCommandException
See Also:
SearchRequest.processResponse(atg.search.routing.command.SearchEngineResponse)

doMerge

public SearchResponse doMerge(java.util.List<SearchResponse> pParsedResponses)
                       throws atg.search.routing.MergeException
Executes the merge. Used internally.

Overrides:
doMerge in class SearchRequest
Parameters:
pParsedResponses -
Returns:
merged response
Throws:
atg.search.routing.MergeException