Many options are available when requesting facets with the faceting API. Some of the most common options are listed in this topic.
These examples use methods that are documented in the FacetBy section of the Query API Reference Guide.
.with_facet_id('id')
Specify an ID by which the resulting
facet can be used with .get_facet('id'), where id is the facet
ID..with_separator('separator')
Specify a separator to split
a single field into a hierarchy of values where separator is any string that
separates the values for your facets. For example, a field that contained the string such as
color.blue.navy could be split using a .with_separator('.') to
create a hierarchy that identifies more specific colors. .with_maximum_facet_values_of(integer)
This option
specifies the maximum number of returnable facet values for a facet. Setting this to something
reasonable (by default, it is 100) will ensure that the application can be navigated correctly by
the user..with_intervals_of(integer)
This option sets the grouping
value for numeric facets. For example, an interval of 10 for a field that contains year values can
be used to group values in ten-year intervals..with_maximum_of(integer)
This option defines the
upper bound on the facet, only numeric fields less than or equal to this value are
returned..with_minimum_of(integer)
This option defines the
lower bound on the facet, only numeric fields greater than or equal to this value are
returned..without_pruning
By default, child facets are pruned if they are
below the top level with multiple facet values. This option will force this facet to be
computed when its parents are..with_or_logic
This option specifies OR logic to be used when
combining multiple facet values. .with_and_logic
This option specifies AND logic to be used when
combining multiple facet values.Calculations are also possible within faceting queries as follows:
sum
To return a sum of the facet
sum('account_size').with_facet_id("facet id")
min
To return the minimum value of the facet
min('account_size')
max
To return the maximum value of the facet
max('account_size')
avg
To return the average value of the facet
avg('account_size')
stddev
To return the standard deviation value of the facet
stddev('account_size')