Expand my Community achievements bar.

Trying to get the OOTB List component working with QueryBuilder (Advanced SEarch) and feed option

Avatar

Former Community Member

 Good day,

Running AEM 6.1... setting up an OOTB list component so i can easily create various atom feeds of news article pages. The list displays my articles when running in html.. but when I test out the feed, the atom feed comes up empty.

using the following query predicates:

 

type=cq:Page
1_property=jcr:content/sling:resourceType
1_property.value=newsroom/components/structure/base-page
property=jcr:content/cq:template
property.value=/apps/newsroom/templates/news-release
relativedaterange.property=jcr:content/@issued
relativedaterange.lowerBound=-3M
orderby.sort=desc

I set my "order by" option in the dialog to "@issued"... limit of 15 with "Enable Feed" option checked. Results are listed in html, but no atom feed entries in feed mode. (Atom feed is output, with no feed entries)

I'm using the QueryBuilder advanced search option.. any ideas?

12 Replies

Avatar

Level 10

So your use case - you want to display JCR data in your feed?  Is your QueryBuilder results pulling any data?

Avatar

Former Community Member

Well.. im not concerned with the html view... i want to generate atom feeds.. but yes... assuming the html view looks like example 3 in your link, id want to turn that into an atom feed (i would throw in a teaser/description in there too)

Avatar

Former Community Member

just to be clear though... i'm not looking at "Consuming" a feed and displaying it as html... i want to generate an atom feed from a query builder search against our JCR using the OOTB list component for users to consume....

Avatar

Level 10

"users to consume"

Can you explain what you mean by users to consume? When using the OOTB LIst component and setting the values in the dialog - the only component that can consume is the component - i am not sure what you mean by users to consume. Can you explain? 

Avatar

Former Community Member

sorry... i mean our website users will be consuming the atom feeds we publish out. So what i'm looking for is to use the OOTB list component, configure it with a QueryBuilder predicate string, "enable feed" and publish that page, so that we can present the atom feed to our public website users.

Avatar

Level 10

I am not sure the OOTB List component can do that. It purpose really is to display data in the web page. 

If you want to serve data (retrieved from the JCR) in this manner from AEM - you may need to write a custom Sling Servlet and then have your other site perform a GET request so the servlet returns the data you want and in the format you want. 

In the Java servlet - look at using an RSS feed API -- like this one: 

http://rometools.github.io/rome/

(this may make a really good community article) 

I believe, you have created your own list component which uses the query to list in html view. In this case you have .html in your component. similarly do you have feed.xml.jsp which outputs the feed for your component ??

Avatar

Former Community Member

this is odd... i guess i am misreading the AEM documentation for the "enable feed" option. in any case.. we do have a Sling servlet that does this, using the Abdera parser to generate feeds, but we didn't like having the query builder predicates coded in our Java. Changes would require a build and deploy of OSGI bundle.

 

We liked how the OOTB list component is doing this.. storing the query as a node string property , and using the QueryBuiler API loadQuery to simply load the query and execute it... so we'll be following this example. This will allow us to define any kind of query predicates for our atom feeds from within CRXDE and simply publish the change.

Avatar

Level 10

" didn't like having the query builder predicates coded in our Java"

This is a valid use case for AEM.

How come you do not like using OSGi for QB predicates? 

Avatar

Former Community Member

I'm fairly new to AEM development, so bear with me. ;-)

We are building up the QB predicates using a hashmap in our servlet.. most of the predicate values we are using are hard-coded in Java. I do have a couple of them (query limit, relativeDateRange) coming from an OSGI config, which we can manage from config nodes in CRXDE.

 

But given the various permutations of predicates we can have, it seemed excessive to code each one as an OSGI config... and better option would be to have them coming directly from the content node for the given atom feed page. We could either list out each QB predicate property we want to use, or based on what the OOTB List component does, provide a TextArea in the dialoge where you enter your QB predicate string directly. (like you do in the QB debugger tool)

 

This way we can tweak the QB predicates easily and simply publish the change...

Does that make sense and good way to go about it?