Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Sorting in search results card view

Avatar

Level 1

Hello Experts, we have below requirements.

 

1. I want to set custom metadata field as default sort option. Currently in card view 4 OOB sorting options are there and default is none. In search results card view there is no sorting option but I did small configuration change so I got the same sort option like normal card view. I am using AEM 6.5.17 on prime. How can I make custom metadata field as default sort option?

 

2. I am able to add custom metadata field in drop down for sorting but when I choose value is back end but results are coming as like when we choose none sort option. I feel back end sorting not happening using custom metadata field. How can make it work?

 

I am looking sort solution for asset search results in card view.

Could you guide me. 

 

Thanks,

Divya

5 Replies

Avatar

Community Advisor

Sorting issues can arise due to several reasons:

1. The frontend might not send the sorting property correctly to the backend.

2. There could be an issue with the metadata property, especially when using Query Builder, where the orderBy clause might not be provided correctly.

Could you provide your backend implementation and how you call the servlet from the frontend? This additional information would help in better understanding the problem.

Avatar

Level 1

Hi @Mahedi_Sabuj Thank you for your response.

 

I didn't write any backend and front end code for sorting. I have just added OOB card view sort options to assets search card view page. I have added below properties to /apps/granite/omnisearch/content/metadata/asset

 

configPath - /apps/granite/ui/content/shell/collectionpage/sort (in apps I can add custom metadata fields which I can see in the drop down)

supportSorting - true.

 

then I can see OOB sort options on search card view page. I have added custom metadata field in sort options but when I choose custom metadata field I am not getting results accordingly but when I choose OOB options like name,created or modified then I am getting results accordingly. 

 

I have added metadata value as 
/jcr:content/metadata/photo:DateCreated.

 

And when I search something by default results are coming without any sort option but I want results based on custom metadata field.

 

How can I add custom metadata field as default sort option and how can I get the results when I choose custom metadata field.

Avatar

Community Advisor

Hello @divyasathish,

 

I don't have 100% hands on experience on this. To me it seems you can add custom predicate to narrow down the search https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/admin/search...

However, documentation doesn't talk about sorting based on custom field: https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/searc...

 

Thanks

 

 

Avatar

Level 1

Hi @A_H_M_Imrul,

 

In card view we have sort options like below if we add custom metadata field results are not sorting accordingly.

divyasathish_0-1694712198186.png

Similar sort options I have added in search page. OOB sort options (Created, Modified and Name) working as expected but if I pass custom metadata field I am not getting results accordingly. I am passing metadata value as /jcr:content/metadata/mycustomfield. How we can get the results based on custom metadata field. ?