afs:facet - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

afs:facet contains the information for a facet of a reply set. Facets must be declared in the PaF configuration in order to be available in the reply set. afs:facet has the following mandatory attributes reflecting the choices made in the PaF module while indexing:

  • id is the identifier of the facet. When using the facet in a parameter (a filter, a cluster, or else) its ID must be given.
  • type is the type of the facet. It can be integer, real, string, date or bool — representing natural numbers, fixed point decimals, character strings, dates or boolean values (true, false) respectively.
  • layout is the way the facet values are structured: tree or interval.
  • For more setting options (such as limiting the number of values of a facet for a query), see Facet options.

afs:facet has the following child elements:

  • A list of afs:label elements stores the localized names of the facet. A localized name is a pair made of a character string (label stored in the label attribute), and a localization (ISO 639-1 code and optionally ISO 3166-1 code, stored in the xml:lang attribute). This list always contains at least one item.
  • Optionally an afs:tags element, containing the tags of the facet, separated by spaces.
  • A list of afs:node child elements is available when the layout is tree or a list of afs:interval child elements when the layout is interval. afs:node and afs:interval are described in afs:node and afs:interval respectively.

Output example:

<afs:facet layout="tree" type="date" id="creation_date">
<afs:tags>MyFirstTag MySecondTag</afs:tags>
<afs:node key="2012-04-14" items="1">
<afs:labels xml:lang="en" label="2012-4-14"/>
</afs:node>
<afs:node key="2112-04-14" items="1">
<afs:labels xml:lang="en" label="2112-4-14"/>
</afs:node>
</afs:facet>

To filter the result set in order to select a given facet value, regardless of its type or layout, the $id=$key predicate must be added to the query, where $id is the value of the id attribute of afs:facet, and $key the value of the key attribute of the selected afs:node or afs:interval element.