Any predefined scalar field can be used, but TERMS is most effective with text fields. The optional
stop term list is a list of terms, enclosed in parentheses, that are excluded from the unique set of terms found within the specified field.
For example, the following request fetches the COUNT of messages grouped by terms found within the
Subject field for a particular sender. For brevity, the
TERMS function is wrapped by the
TOP function to limit the results to the five groups with the highest counts:
Similar to the BATCH function, the
TERMS function creates dynamic groups from a text field based on the terms it uses. To do this, as objects matching the query parameter (if any) are found, the field passed to
TERMS is parsed into alphanumeric terms, and a group is created for each unique term. Each contributes to the group metric computation for each term it contains. If a term appears multiple times within a field (e.g., “plan for a plan”), the object is only counted once. An example result in XML is shown below: