Expand my Community achievements bar.

Different search facets on asset search based on folder metadata schema

Avatar

Community Advisor

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.

5 Replies

Avatar

Community Advisor

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

Avatar

Community Advisor

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.

Avatar

Community Advisor

/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.

Avatar

Community Advisor

Hi, 

thanks for replying but it doesn’t seems to work as searchpanel.jsp only get called when omnisearch initialize but not on when search is performed again on omnisearch or user update the folder location. So I decided to check if I can do the hide and show of fields based on search path but I am not able to assign any custom css class to the the search form fields using granite: class. Any idea how can I add custom class to search form fields 

Avatar

Community Advisor

It seems not all predicate support granite:class property but I found one predicate called Insight Predicate(group predicate) and will do the grouping of custom metadata fields added for particular folder based on the metadata scheme and will do the show hide of Insight Predicate(group predicate).

if any one has any better solution/ suggestion I am open to hear.

thanks