There are multiple times we have encountered scenarios' where client need some pages to come on top in search results or say in a specified order.
Like for example We have a scenario where the ordering of the search results needs to be first blogs pages then press-release then content fragment results and then all other pages. So the easiest way to achieve this by using the root page path field used in your custom search component.
Create a multifield for search root path and add the paths according to your scenario. For above stated scenario it will be something like this.
Query created will be:
p.limit=-1
fulltext= test
1_group.p.or=true
1_group.1_group.type=cq:Page
1_group.1_group.path=/content/we-retail/us/en/blogs
1_group.2_group.type=cq:Page
1_group.2_group.path=/content/we-retail/us/en/press-releases
1_group.3_group.type=dam:Asset
1_group.3_group.path=/content/dam/hbff/content-fragments/events
1_group.4_group.type=cq:Page
1_group.4_group.path=/content/hbff/us/en
Hope this helps!!
Happy Coding 🙏
Comments
Post a Comment