Faceted search has become a popular technique and very nice way to help narrowing down search results or improve the navigation of a site. With facets you define how to classify content objects or query results. You can display all or the most interesting values within the classification, which immediately show the count of resulting objects, if the query would be narrowed by including the faceted value as filter.

Apache Jackrabbit does not yet provide out-of-the-box faceting support. In order to provide this functionality for our users, the Jahia team looked for ways to integrate Apache Solr - one of the most popular Apache Lucene based open source solutions offering faceting support - into Jackrabbit. This turned out to be a difficult endeavor as Solr was not designed to easily be integrated with other frameworks, in particular to work with indices that were not created with Solr. We nevertheless were able to implement a solution, in the form of the SimpleJahiaJcrFacets class, to bridge Jackrabbit and Solr. SimpleJahiaJcrFacets is very similar to Solr's SimpleFacets class and reuses classes from solr-common to work with exactly the same facet query syntax and result objects as Solr does. It is therefore highly recommended to learn more about Solr faceting to work efficiently with facets in Jahia Digital Factory.

The Jackrabbit version that we use in Jahia Digital Factory still uses Lucene 2.4.1. This, in turn, constraints the versions of Solr we can use. As a consequence, we were forced to use Solr 1.3. As soon as we upgrade to a newer version of Jackrabbit that supports more recent Lucene versions, we will also be able to support features from newer Solr versions.

Support for faceting in Jahia Digital Factory is provided by the Facets module. It is therefore important to activate the module for your site if you intend to use facets.

Configuring properties for faceting

Simple faceting

Node properties that are used for faceting will, in most cases, require a second indexing, different from the normal one, to support faceting. This is needed because analyzers usually perform stemming, lowercasing and tokenizing before indexing a field. However, in order for a value to be useful for faceting, it:

  • should not be tokenized into separate words
  • should not be lowercased
  • should not have punctuation removed
  • should not be stored in the index

Jahia extended the Compact Node Definition (CND) format to make it possible to easily specify that a given property should be used for faceting. This is accomplished by adding the facetable attribute to the property you want to mark for faceting indexing. Below is an example, where the startDate, endDate, location and eventsType properties are marked as facetable and will therefore be indexed specifically for faceting (in addition to the regularly performed indexing): 

[jnt:event] > jnt:content, jmix:editorialContent, mix:title, jmix:structuredContent
- startDate (date) facetable
- endDate (date) facetable
- location (string) i18n facetable
- eventsType (string, choicelist[resourceBundle]) facetable  < meeting,consumerShow,roadShow,conference,show,pressConference
- body (string, richtext) i18n 
Note that if you decided to make a property facetable after content has already been created for that particular nodetype, you will need to rebuild the indices as explained in the Rebuild indices section.

Facetable fields are prefixed by FACET: in the index.

Hierarchical faceting

Jahia 6.6.1 added support for hierarchical field value faceting. Hierarchical faceting, as its name implies, means that facets can leverage existing hierarchy in the data to offer more intuitive filtering. Using hierarchical faceting, you can filter your data to see items at a specific hierarchical level along with all of their children. For example, when you filter on a specific category, you will not only get nodes categorized with exactly this category but also nodes categorized with any of its children category.

Marking a property as being a target for hierarchical faceting is as easy as using the hierarchical attribute for this property in the associated nodetype definition. Here is how this is done for the jmix:categorized mixin containing the hierarchical facetable field j:defaultCategory:

[jmix:categorized] mixin
extends = nt:hierarchyNode, jnt:content, jnt:page
itemtype = classification
- j:defaultCategory (weakreference, category[autoSelectParent=false]) facetable hierarchical multiple
Note that this behavior for categories is different from what was previously available in Jahia anterior to version 6.6.1. This also changes filed facets behavior on j:defaultCategory as, up to version 6.6.1, only counts for real assignements were displayed. The behavior since 6.6.1 now takes into account the parents of the assigned category for the facet count. If you'd rather revert to the previous behavior, you could remove the hierarchical attribute on j:defaultCategory or distinguish between hierarchical and non-hierarchical categories with a second category property.

Facet types

As Jahia Digital Factory leverages Apache Solr for faceting, it supports all the facet types (field, date, range, queries) available in Apache Solr. See Facet types and their parameters to get a description of all supported facet types and parameters.


Jahia not only offers backend access to run facet queries, but also provides a facet module with several components to help in creating templates using faceting support simply with drag and drop in the Studio.