8. Facets

YAZ supports facets in the Solr, SRU 2.0 and Z39.50 protocols.

Like Type-1/RPN, YAZ supports a string notation for specifying facets. This notataion maps straight to facets.asn. The notation is parsed by function yaz_pqf_parse_facet_list defined in header yaz/pquery.h.

For ZOOM C the facets are specified by option "facets". For yaz-client, the 'facets' command is used.

The grammar of this specification is as follows:

   facet-spec ::= facet-list

   facet-list ::= facet-list ',' attr-spec | attr-spec

   attr-spec ::= attr-spec '@attr' string | '@attr' string


The notation is inspired by PQF. The string following '@attr' must not include blanks and is of the form type=value, where type is an integer and value is a string or an integer.

There is no formal facets attribute set (it is not given in the protocol by the facets, although it could). The following types apply:

Table 7.4. Facet attributes

1 Field-name. This is often a string, e.g. "Author", "Year", etc.
2 Sort order. Value should be an integer. Value 0: count descending (frequency). Value 1: alpha ascending.
3 Number of terms requested.
4 Start offset (starting from 1)