Search results contain a ranked list of matching statements, sorted by relevancy. These raw results could contain duplicate or similar statements or come from a limited set of documents, offering little variety of information for the end-user. To prevent these problems, Oracle ATG Web Commerce Search offers two grouping levels.

In grouping by document, Search reviews the list of matching statements and collapses those that come from the same index item, forming groups of document results. Parameters control the size of result groups and the number of the result groups to return. Individual results that belong to a group that exceeds the size limit are eliminated from the response.

For example, if the query requests the first 20 result groups by document, but restricts the number of the groups to 1, then Search returns the 20 most relevant statements from 20 unique documents, eliminating less relevant statements from the same documents. If the query restricts the number of groups to 3, then Search returns the 60 most relevant results in groups of 3, one group for each unique document. The result objects of the response denote which group they belong to.

Grouping by document allows the user to make a quick survey of the kinds of answers available in the returned documents, but less relevant statements can end up higher on the results list than more relevant statements.

In grouping by property, Search groups matching statements according to a metadata property of their documents. Thus, the grouped results may not share the same document or the same text. The typical scenario for this is a commerce application where you index SKUs as searchable items, but want to return results at the product level. The results can be grouped by a product ID metadata property, so that all SKUs with the same product ID value are in the same group.

The sorting attribute determines which grouping mode is used for browse results:

<browse sorting="mode"

The mode value can be document or property.