Configure Faceted Tree Filters
Introduction
Goal
Configure filters in a faceted tree.
Background
When configuring a faceted tree, it is possible to add filters.
Configuration
You can configure filters on any hippofacnav:facetnavigation node using the multi-valued String property hippofacnav:filters. All filters are being AND-ed. We support currently the following formats as a filter:
- jcr:primaryType = nodeType
- propertyname = propertyvalue
- propertyname != propertyvalue
- contains(. , text)
- contains(propertyname, text)
- not(expression)
- text
Examples
Node Type
Only include documents of type myhippoproject:newsdocument in the faceted tree's result sets:
hippofacnav:filters: [ 'jcr:primaryType = myhippoproject:newsdocument' ]
Property Value
Only include documents with property myhippoproject:brand having the value 'hippo':
hippofacnav:filters: [ 'myhippoproject:brand = hippo' ]
Exclude documents with property myhippoproject:brand having the value 'hippo':
hippofacnav:filters: [ 'myhippoproject:brand != hippo' ]
Document-Scoped Free Text Query
Free text search in any property of any descendant node. If there is no result set sorting configured, the result set is ordered according Lucene scoring. The query syntax mostly follows the Lucene QueryParser syntax with some exceptions (see below). A space is interpreted as AND.
Not supported from the Lucene QueryParser syntax are:
- fuzzy searches
- proximity searches
- range queries
- wildcard at the start of a keyword
Examples:
Only include documents containing the word 'jump':
hippofacnav:filters: [ 'contains(.,jumps)' ]
Only include documents containing 'quick' AND 'jump':
hippofacnav:filters: [ 'contains(.,quick jump)' ]
Only include documents containing 'quick' OR 'jump':
hippofacnav:filters: [ 'contains(.,quick OR jump)' ]
Only include documents which contain the words 'brown fox jumps' in this exact order:
hippofacnav:filters: [ 'contains(.,"brown fox jumps")' ]
Only include documents with words that match bro?n, where ? is any single character:
hippofacnav:filters: [ 'contains(.,bro?n)' ]
Only include documents with words that match laz*, where * is any character array:
hippofacnav:filters: [ 'contains(., laz*)' ]
Only include documents containing 'quick' OR 'jump' and in the scoring, consider the word 'quick' 10 times more important:
hippofacnav:filters: [ 'contains(.,quick^10 OR jump)' ]
If only text is filled in, the filter is treated as if it is: contains(.,text)
For example:
hippofacnav:filters: [ 'quick brown fox' ]
is equal to
hippofacnav:filters: [ 'contains(.,quick brown fox)' ]
Property-Scoped Free Text Search
Similar to document-scoped free text search, but restricted to a specific document property.
For example, to only include documents containing 'hippo' OR 'onehippo' in their myhippoproject:title property:
hippofacnav:filters: [ 'contains(myhippoproject:title, hippo OR onehippo)' ]
Negation
Any of the expressions above can be negatred by wrapping not() around it, for example:
hippofacnav:filters: [ 'not(myhippoproject:brand = hippo)' ]