Different search facets on asset search based on folder metadata schema | Community
Skip to main content
DPrakashRaj
Community Advisor
Community Advisor
October 3, 2024

Different search facets on asset search based on folder metadata schema

  • October 3, 2024
  • 1 reply
  • 964 views

Hi I have a requirement in which we are maintaining multiple metadata schema for assets and now based on the folder metadata schema we have different search forms(search schema). Has anyone implemented this for aem cloud service to load the search forms(search schema) based on folder on which search is being performed.

my idea is to create a service that will read the folder metadata schema and provide the path for appropriate search forms to load but not able to find the way to invoke this custom service class to override the OOTB search form load. Default search form path is stored on /libs/dam/content/seatchpanel node as jcr property predicatepath=“dam/search/facets/assests” and this property is being read on /libs/cq/gui/components/coral/common/admin/searchpanel/searchpanel.jsp on line 48 as String predicatePath = cog.get(“predicatePath”, String.class);

any help is really appreciated.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

h_kataria
Community Advisor
Community Advisor
October 3, 2024

Are there any issues you are facing in overriding searchpanel.jsp ? 
Disclaimer : I have not worked on it, but just curious.  

DPrakashRaj
Community Advisor
Community Advisor
October 3, 2024

First thing that jsp is not recommended on aem cloud and not sure if pipeline will allow this jsp to get deployed during the build. Other thing is that I am facing difficulties in getting the assets folder path on this searchpanel.jsp to pass as an argument to the custom service class.

h_kataria
Community Advisor
Community Advisor
October 4, 2024

/libs/dam/content/searchpanel is under public area so I dont think there should be any issue in overlaying it and pointing it to your custom script. 

I also checked and it seems trickier to get the current assets path in searchpanel.jsp. I think one way to go about it could be to drive it from client side, by setting a cookie which has the desired path and then retrieving it in your custom script.

I tried adding cookie logic in /libs/granite/ui/components/shell/clientlibs/shell/js/omnisearch/omnisearch.js for $(document).on("granite-shell-omnisearch-predicate-location:updated") event which was triggering when omnisearch is initialized (you could use some other event as well) and then retrieving in jsp which seemed to work fine.
Hope this helps.