As described in the Result Groups section of the Standard Query chapter, ATG Search returns a list of result groups in its query 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 date or source or format. This secondary sort does not effect 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 the following attributes:
<structquery docSort="mode
" docSortOrder="order
" docSortProp="prop
"
docSortPropDefault="def
"
The mode
value specifies how the result groups are sorted, and can be one of the following:
relevance
– the default value, return groups in relevance orderalpha
– sort groups by filename of index item, meaning the last part of the full URL (for example,index.htm
)address
– sort groups by web site address of the index item, meaning the beginning of the full URL (for example,http://www.mycorp.com
)url
– sort groups by full URL of the index itemdate
– sort groups by last modified date of the index itemstrprop
– sort groups by a metadata string property, requiresdocSortProp
attributenumprop
– sort groups by a metadata number property, requiresdocSortProp
attributetitle
– sort groups by title of the index itemtype
– sort groups by the type of the index item, such as HTML or PDFdocset
– sort groups by physical document set
Note that all the sort modes use the index item of the first result in the group. For group-by-document, all results have the same index item, so this is not important. However, for group-by-statement, the results will have different index items, and only the first (most relevant) result is significant. The order
value determines whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode. The order
value should be either ascending
or descending
.
The prop
value specifies the property name to use for the strprop
or numprop
modes. The property name must be a valid property of the given type; that is, for strprop
, either string
or enum
, and for numprop
, either integer
, float
, boolean
or date
. Index items that don’t have this property will be excluded from the sort. To prevent that, the def
value can specify the default property value to use for these exceptional cases. The def
value should agree with the type of the property.