How to sort/filter search result in Sitecore SXA by
__created date or
__updated date to retrieve recent search items
Create facet item
- Navigate to your site facets node
- Add new item using following template
- Fill field name with the name of the field stored in index. (In my case it will be
movie_releasedas I am showing you configuration from my example site)
Add rendering to a page
- Open page where you want to display results
- Add Search Results rendering (will be used to display sorted results)
- Add Sort Results rendering. When adding create new data source item for it (template:
- Next create your filter configuration items under datasource created above. You can do it in CE.
- Title - used for displaying purposes
- Facet - select your date facet that you create in step 1.
- Direction - there are two directions: ascending and descending. Normally you create two option items for a single facet, on for asc. and another for desc. order.
If you are new to SXA you can learn how to use different renderings from XA.Reference. I created a reference site which shows how to configure every rendering in SXA. It is standard Sitecore package with example site inside.
Latest release supports SXA 1.2