Facets-class: Facets

Facets-classR Documentation



The Facets object represents the result of a Solr facet operation and is typically obtained by calling facets on a SolrCore. Most users should just call aggregate or xtabs instead of directly manipulating Facets objects.


Facets extends list and each node adds a grouping factor to the set defined by its ancestors. In other words, parent-child relationships represent interactions between factors. For example, x$a$b gets the node corresponding to the interaction of a and b.

In a single request to Solr, statistics may be calculated for multiple interactions, and they are stored as a data.frame at the corresponding node in the tree. To retrieve them, call the stats accessor, e.g., stats(x$a$b), or as.table for getting the counts as a table (Solr always computes the counts).


  • x$name, x[[i]]: Get the node that further groups by the named factor. The i argument can be a formula, where [[ will recursively extract the corresponding element.

  • x[i]: Extract a new Facets object, restricted to the named groupings.

  • stats(x): Gets the statistics at the current facet level.


  • as.table(x): Converts the current node to a table of conditional counts.


Michael Lawrence

See Also

aggregate for a simpler interface that computes statistics for only a single interaction

rsolr documentation built on May 18, 2022, 9:07 a.m.