Apply Runtime Filters to a Faceted Tree

Overview

This page describes how to apply runtime filters to a faceted tree at the repository level in Bloomreach Content.

When to Use Runtime Filters

By default, filters configured in a faceted tree are always applied during navigation and cannot be changed dynamically. Runtime filters allow you to apply filters on demand by modifying the faceted tree's JCR path. Use runtime filters when you need to filter results dynamically, without changing the underlying faceted tree configuration.

For information on using runtime filters in the delivery tier, see Faceted Navigation Combined with Free Text Search and HST Queries.

How Runtime Filters Work

A runtime filter is specified as either a Lucene query or an XPath constraint. Place the filter expression between square and curly brackets, and append it to the JCR path of the faceted tree.

Example syntax:

/content/documents/myproject/faceted-news[{expression}]/

To test runtime filters in a local development environment, use the Repository Servlet:

http://localhost:8080/cms/repository/content/documents/myproject/faceted-news[{expression}]/

Examples

Free Text Queries

Filter documents containing the word 'hippo':

/content/documents/myproject/faceted-news[{'hippo'}]/

Filter documents from 2017 containing the word 'hippo':

/content/documents/myproject/faceted-news[{'hippo'}]/Year/2017

Filter documents from 2017 containing both 'hippo' and 'gogreen':

/content/documents/myproject/faceted-news[{'hippo gogreen'}]/Year/2017

XPath Queries

Filter documents from 2017 containing both 'hippo' and 'gogreen' (equivalent to the previous example):

/content/document/myproject/faceted-news[{xpath(//*[jcr:contains(.,'hippo')])}]/Year/2017

Filter documents from 2017 where the myproject:location property is 'Mountain View':

/content/document/myproject/faceted-news[{xpath(//*[myproject:location='Mountain View'])}]/Year/2017

Filter documents containing the word 'hippo' and boost results where the myproject:title property also contains 'hippo':

/content/document/myproject/faceted-news[{xpath(//*[jcr:contains(.,'hippo') or jcr:contains(@myproject:title,'hippo'))]}]/

Specify ordering in the XPath query to override the sorting configured in the faceted tree:

/content/document/myproject/faceted-news[{xpath(//*[jcr:contains(.,'hippo')] order by @myproject:date descending)}]/

Note: Range queries in XPath are CPU-intensive and slow. If possible, configure facet value ranges in the faceted tree instead of using range queries at runtime.

Share Feedback
Page: /build/search/faceted-navigation/apply-runtime-filters-to-a-faceted-tree
Section: Build
Category *
Apply Runtime Filters to a Faceted Tree | Bloomreach Content Documentation