Faceted navigation - capitalizing the category names
Facet categories that are generated from metadata field values are lower-cased by default when calculating the counts in order to merge variants of the field names into a single count.
This prevents duplicate categories appearing in the listing.
e.g. a metadata field containing values like Singapore
, singapore
and SINGAPORE
should all be counted together.
The compromise is that any capitalization applied in the metadata field values is not preserved when presenting the categories to the users.
How do I preserve or capitalize my field values
There are a few ways this can be achieved.
Treat metadata categories as case-sensitive
There is a setting that tells Funnelback to treat the field values as case-sensitive when performing the category counts. This will preserve the exact casing in the metadata field values, but can result in duplication as outlined above.
To enable case-sensitive field names add -rmc_sensitive=true
to the query_processor_options
that are configured in the results page settings where the faceted navigation is configured.
This setting will turn on case-sensitivity for all the facets you have defined on the results page. |
If you refresh your search results the case should be preserved as this setting is applied at the time you execute your query.
Use CSS to capitalize your category names
CSS can also be used to apply capitalization to your field names.
To implement this you will need to apply styling to your template and configure the appropriate text-transform CSS styles. CSS includes option to capitalize the values, or present them as uppercase or lowercase.
Use this method if you can’t reliably treat the fields as case-sensitive (because some fields contain variants). The trade-off is that the capitalization options are limited and this approach might not be suitable if you contain a mixture of acronyms and normal words in your field (e.g. USA, Canada) |
Use the metadata normalizer filter
The metadata normalizer filter can be used to normalize specific metadata field values using a rules-based configuration file.
This allows you to convert field variants into a preferred version of the term and then apply case-sensitivity to the field name.