Filter Processors

Filter response processors include ones to perform these operations:

  • Capitalise the display value of the given filter.

  • Parse dates out of facet filter values.

  • Sort facet filters by count.

  • Sort facet filters by actual value.

  • Replace display values in FacetFilters for specified or all Facets.

  • Retrieve other filter values for the same facet, despite there being one or more filters for that facet already applied.

  • Remove facet filters that match a regular expression pattern from a facet.

  • Replace filter values (actual, display, or both) that match a given regular expression with a different value.

  • (Since 4.2.0) Dynamically format the display value of a date range facet according to the size of the range.

twigkit.search.processors.response.CapitaliseFilterValuesProcessor

Capitalise the display value of the given filter.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

twigkit.search.processors.response.FacetFilterDateParser

Parse dates out of facet filter values (which converts the underlying value type from String to Date).

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

pattern (java.lang.String)
Date formatting pattern of the String to be parsed for example, dd/MM/yyyy

twigkit.search.processors.response.FacetFilterSortByCount

Sort facet filters by count.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

twigkit.search.processors.response.FacetFilterSortByValue

Sort facet filters by actual value.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

type (java.lang.String)
Sort by number, string or date.
Default: string

direction (java.lang.String)
Either 'ascending' or 'descending'.

twigkit.search.processors.response.FacetFilterValueMappingProcessor

Replace display values in FacetFilters for specified or all Facets. This is a convenient way, for example, to replace display values in facets with boolean values.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

mappings (java.lang.String)
Mappings parameter defines the mappings/replacements that should be done on the FacetFilter display values. For example, mappings="en=English,fr=French" will replace all instances of en and fr in the FacetFilter list with the full English/French variants.

twigkit.search.processors.response.ParallelFilterProcessor

Retrieve other filter values for the same facet, despite there being one or more filters for that facet already applied.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

platform (twigkit.platform.Platform)
The platform instance to use when resubmitting the query with the facet filters removed (so that parallel filter values can be retrieved).

twigkit.search.processors.response.RemoveFacetFiltersByRegex

Remove facet filters that match a regular expression pattern from a facet.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

pattern (java.lang.String)
A regular expression pattern for the filters that should be removed.

twigkit.search.processors.response.ReplaceFilterValue

Replace filter values (actual, display, or both) that match a given regular expression with a different value. The replacement value can contain back references to matches.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

replace (java.lang.String)
The pattern to replace (can contain regular expressions).

with (java.lang.String)
The replacement (can contain backreferences to the regular expression pattern).

values (java.lang.String)
Whether to replace 'actual', 'display' or 'both' values.
Default: 'both'

ignoreCase (java.lang.Boolean)
Whether to ignore case during pattern matching.
Default: false

twigkit.search.processors.response.ApplyDynamicSolrDateFormattingResponseProcessor

Since 4.2.0

Dynamically format the display value of a date range facet according to the size of the range. This assumes the facet was generated by applying the twigkit.search.processors.query.DynamicSolrDateRangeQueryProcessor processor.

facetNames (java.lang.String)
Comma-separated list of facets that should be affected by this processor.

day-format (java.lang.String)
The format to apply to day size range filters.
Default: dd-MM-yyyy

month-format (java.lang.String)
The format to apply to month size range filters.
Default: MM-yyyy

year-format (java.lang.String)
The format to apply to year size range filters.
Default: yyyy

Example configuration

name: twigkit.search.processors.response.ApplyDynamicSolrDateFormattingResponseProcessor
facet-names: Modified Date
month-format: yyyy-MM
day-format: yyyy-MM-dd