Configuration Files
There are additional configuration files that you can use to customize the UI and behavior of the Coveo module. You can find these files in the config
directory of the coveo
module.
The list of available configuration files is as follows:
facet.config.ts
fields.config.ts
pagination.config.ts
sort.config.ts
There is also a general purpose config object that you can use to get interesting configuration information. Import the config
object from the @sf-modules/coveo
module.
import { coveoConfig } from "@sf-modules/coveo";
If you are interested in extending the configuration class, please check coveo.config.ts
file in the coveo
module.
Facet Configuration
This file contains the configuration for the facets that are displayed in the search results. You can customize the facet options, such as the number of items to display, the sort order, and the facet options. Use this file to define the facets that will be displayed in the search results and category pages.
Supported Coveo Facets types:
Facet (coveo type) | Is supported? |
---|---|
normal | ✅ |
numeric | ✅ |
range | ❌ |
date | ❌ |
hierarchical | ✅ |
There is one restriction for the facet configuration that you need to be aware of. The key name of the facet must be the same as the field
value. Below you can find an example of the facet configuration file.
ec_color: { // must be the same as the field value
field: 'ec_color', // must be the same as the key name
facetId: 'ec_color',
label: 'Color',
type: 'COLOR',
numberOfValues: 50,
}
Fields Configuration
Headless library allows to configure fields that are returned from the API. This file contains the configuration for the fields that are returned from the API. You can customize the fields that will be returned from the API.
Pagination Configuration
This file contains the configuration for the pagination that is displayed in the search results. You can customize the pagination options, such as the number of items to display, the sort order, and the pagination options.
Sort Configuration
This file contains the configuration for the sort options that are displayed in the search results. Use it to map the sort options keys from the UI to the Coveo API sort options.