Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Customize Content Finder Searches

Avatar

Level 2

I've recently inherited development on a CQ 5.5 instance. Part of this site is a custom asset management wrapper around the DAM. As part of that asset management, we set a particular property on assets that indicates they are populated with required metadata. We have the requirement that only assets that have this property set to true should be visible in the content finder. Before I started working on this, custom content finder tabs had been developed that link to servlets that enforce this requirement of the "populated" property being true. However, the default tabs (i.e. Images, Documents, etc.) have no knowledge of this of course. I'm trying to figure out the easiest way to add support for this requirement to the default tabs. The one thing I have tried, which did not appear to work, was to overlay the images tab and add additional baseParams values, like the following:

}, { "baseParams": { /*"defaultMimeType": "image"*/ "mimeType": "image", "1_property": "jcr:content/metadata/populated", "1_property_value": true } })

I've also noticed that these tabs post to "/bin/wcm/contentfinder/asset/view.json/content/dam", which maps to com.day.cq.wcm.core.impl.servlets.contentfinder.AssetViewHandler. Another thought I had was to write my own handler that extends AssetViewHandler, whose doGet() method takes a Predicate as a parameter, and simply add my own predicate and call super.doGet(). Then I could overlay all the default tabs and change the url value to point at my handler. I'm not sure if that's even possible however. I'm hoping someone has done this before and can offer some advice. Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Looking in to http://dev.day.com/docs/en/cq/current/widgets-api/index.html it does not look like we can provide custom predicate to CQ.wcm.ContentFinderTab. Here is one example that might help http://chanchal.wordpress.com/2013/06/26/how-to-add-your-own-content-finder-tab-in-cq5/

Yogesh

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

Looking in to http://dev.day.com/docs/en/cq/current/widgets-api/index.html it does not look like we can provide custom predicate to CQ.wcm.ContentFinderTab. Here is one example that might help http://chanchal.wordpress.com/2013/06/26/how-to-add-your-own-content-finder-tab-in-cq5/

Yogesh

Avatar

Level 2

Thanks for the response, but I already know how to create my own tab. In fact, the link you posted is from my codebase...I guess the contractor who created that code before I took over wrote that blog post! I really want to re-implment as little as possible. I tried the approach of overriding com.day.cq.wcm.core.impl.servlets.contentfinder.AssetViewHandler with the intent of overriding the createQuery() method so I could add my additional criteria. The problem I ran into was that the server seemingly failed to register my configured @SlingServlet paths. Is there a way to override an existing servlet and specify my own path or have my class be called instead at the path specified by the servlet I am overriding?

Avatar

Level 2

It turns out that we had a custom tab that implemented a search that I could leverage, so I just overlaid the images.js and documents.js tabs and updated the url property for each. That got me what I needed.