Group Facets for Simultaneous Filtering

The Facet List Form tag groups together a collection of facets for which filters should be applied simultaneously.


Facet filters can be rendered in one of two ways: in 'click' mode, the user selects a filter by clicking the value, and in 'checkbox' mode, the user can tick a box next to each filter to apply a disjunction of multiple filters. By default, each checkbox facet in a facet list is processed separately from the others. This means that there is a separate 'Apply filters' button for every facet and a selection made for one facet does not get submitted when a user presses the 'apply' button for another facet.

The Facet List Form tag lets the user change this behaviour, by submitting filters for multiple facets simultaneously. This can be desirable if, for example, the application has a large number of facets that take a long time to render. The facet query submitted by the Facet List Form is constructed by combining all filters for the same facet using an 'OR' operator, and then combining the queries for each facet using 'AND'. Clearly, if any of the facet filters combined in this way are disjoint (say, kingdom:Bacteria and species:Homo sapiens), then the query can lead to no results.

To guard against this, the Facet List Form tag optionally checks how many documents would be matched each time the user ticks a checkbox, and only lets the user submit the selection if the expected number of documents is greater than zero. This example demonstrates how this tag is used.

<search:facetListForm query="${query}" platformName="platforms.myplatform" checkResultCount="true">
    <search:facetList response="${response}" facet-names="cat=Category,manu_exact=Manufacturer">
        <search:facet select="checkbox" />

JSP tag attributes

query (twigkit.model.Query)
The Query to submit based on which filter is selected. This will be used to dynamically update the expected number of documents matching the user’s current facet filter selection (see checkResultCount, below).

platformName (java.lang.String)
The fully-qualified configuration name of the search platform which the facet query should be sent to.

checkResultCount (java.lang.Boolean)
If enabled, the tag will asynchronously submit the current filter selection to a REST service, which returns how many documents would match the query. The number of matching documents is output next to the 'apply' button on the page and the button is enabled if, and only if, the number is greater than zero.

Tag body variables


Expected tags in body