Types of faceting

Solr's faceting is broken down into five types. They are as follows:

  • field: This is the most common type of faceting which counts the number of occurrences of each indexed term in a field. The facet counts are grouped in the output under the name facet_fields.
  • range: Given a numeric or date field, this creates facets for a set of ranges. The facet counts are grouped in the output under the name facet_ranges.

    Note

    Solr 3 deprecated date faceting with the introduction of the generic range faceting. We won't document it further.

  • query: This is a very flexible type of faceting which counts the number of documents matching each specified query. The facet counts are grouped in the output under facet_queries.
  • pivot: Also known as decision tree faceting, this type of faceting allows recursive faceting across a set of fields. Results are grouped under facet_pivot.
  • interval: A Solr 4.10-only feature, an interval facet is similar to a query facet with range queries. While the same results can be achieved using query facets with range queries, interval facets are implemented differently and, therefore, have different performance characteristics.

In the rest of this chapter, we will describe how to do these different types of facets. But before that, there is one common parameter to enable faceting:

  • facet: It defaults to false. In order to enable faceting, you must set this to true or on. If this is not done, then the faceting parameters will be ignored.

In all of the examples in this chapter, we always set facet=true.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.17.20