Facets are a useful method of refining your search results using various characteristics of your content. They allow you to use a Yext Content field as a type of dynamic filter that a user can interact with in the frontend search experience to narrow the search results.
Facets are visible post-search, since they’re dependent on the search query, and can be used to further refine a query. Facets usually have a number next to each one, to indicate the result count. You can see an example of Facets in the left sidebar below. To learn more about Facets visit the Facets and Filters (Backend) training module.
Note: Facets are only supported on vertical search.
To add a facet in the UI:
- Click Search in the navigation bar and click on the desired Search experience. You'll land on the Verticals screen.
- Select the vertical you want to add Facets to.
- Click on the Filters tab.
- Find the Facets box and click + Add / Update Fields. A dialog box appears.
- Select the checkboxes next to the fields you want to add as facets and uncheck any fields you want to remove. Then click Update.
- Click Save.
To add a facet using the JSON Editor:
- Click Search in the navigation bar and click on the desired Search experience.
- Click Edit in JSON to navigate to your Search Configuration file.
- In the relevant vertical add the custom field as a Searchable Field.
- Then add the Facet Filter via JSON
“facet”: true
within thesearchableField
object. - Click Save.
It should look something like this:
"searchableFields": {
"c_jobDepartment": {
"facet": true
}
}
Once you have set your facet in the backend, you will need to make sure it appears in the frontend experience. The steps vary depending on your implementation method, visit the relevant documentation below for the steps to add Facets to the frontend:
- Hitchhikers Theme: Facets and Filters (Frontend) training unit
- Search SDK: Facet component
- Search UI Reach: Facets component
- Search Endpoints
- Search Core
Comments
0 comments
Article is closed for comments.