Facets are used to group search results based on predefined fields. They allow users to further narrow down search results.
PREREQUISITES: Facets are available for Elasticsearch and Azure search services.
Create facetable fields
If you want to include facets in your search results page, you must first create facetable fields. These fields can only be dynamic module items or custom fields created for any module.
The fields that are indexed by default when you create an index are not facetable. For more information, see Create search indexes.
To mark fields as facetable you need to edit or create an index.
- Navigate to Administration » Search indexes.
- Click Create a search index or open an index to edit.
- If you have Elasticsearch or Azure search service setup, you can see the option to specify addition fields as facetable.
- In the Label field you can add a name for the field visible for site visitors in the search result page.
- Save changes.
- If you edited an existing index, reindex it.
Configure Search facets widget
- Place the Search facets widget to the same page as the Search results widget.
- Select a search index. The search index must be the same one used in the Search results widget.
You can only see indexes that have at least one field marked as facetable.
- Fields configured as facetable are automatically displayed.
If you do not want to display all facetable fields in the search results page you can remove any of the by clicking the x next to the name of the field. Or you can add more from the add button.
If you add multiple fields with the same name, only the last one added is displayed in the search results page.
- In the Label fields, you can change the label of the field here. For instance, you can use another language to translate the original field name. You can also leave the label field empty if you do not want to have a label name.
- Select how you want to sort the fields.
- As set manually – keeps the order you have specified via dragging and dropping the fields in the field above.
- Alphabetically – sorts the fields alphabetically according to their label name.
- Set whether to display item count in the facet search results.
- Set whether you want to collapse large facet lists. If you click Yes, only the first ten entries are displayed and a button appears to show the rest.
- You can save this widget template by adding a template name
- Click Save.
Advanced settings of the Search facets widget
In advanced settings you can configure the following options:
- CSS class – add CSS resources.
- Search fields - List of fields to be used in the search facets. These fields must be the same as those specified in the Search results widget.
You can also change the following labels and messages
- Search facets header
- Search facets label
- Clear facets link
- Show more link
- Show less link
Facets and permissions
The search results from facetable fields cannot be filtered by permission, therefore the facet category includes a count of the results even if they are not accessible. Fields with sensitive information should not be made facetable.