First attempt at using an auto-index with queries

Hi everyone: I’ve been publishing with Percussion for about a year, but it’s a very small portion of the development I do, and until now we’ve done fairly basic flat publishing within the site. We now have occasion to do some dynamic, tag-based publishing, which I’ve attempted to set up with an auto slot. I can’t quite get it all working, and I wanted to see if anyone could point me in the right direction. I’ll briefly describe my set-up:

I’m trying to automatically publish some podcasts from a nested directory to a multimedia page that contains a few other elements. I have created a “Dynamic Index” content_type (note: I’m using generic names in this post to make things easier to follow). This is for the overall page and utilizes basic fields like title, body, etc.; nothing to it. It uses a “Dynamic Page” template by default. This template echoes out the title, body, etc, and then calls in an “AutoQuery” slot. My "AutoQuery slot uses “sys_RelationshipContentFinder” as its content finder. It allows for an “AutoIndex” content_type, and a “Podcast Link” template. (this is where I get fuzzy, but it seems to be how things are documented.)

My “AutoIndex” content_type contains a “query” attribute which points at a keyword query. This keyword query contains a number of Label-Value pairs displayed in single-select dropdown. The values correspond to JSR queries that return various sets of content_items … in this particular case, a list of podcasts. I have tested the query out in the Rhythmyx query tester, and I can confirm it returns a couple podcast items.

In my “Dynamic Page” template, I use the following code to call in the slot:

#slot(“AutoIndex”, “” “” “” “” “template=Podcast Link”).

So, I create a content_item called “Index” of the “Dynamic Index” type … give it a title, body, etc. In Active Assembly, I then insert another content_item I’ve created of the “AutoIndex” type, which simply selects the podcast query among its options.

My question is this … how and where do I define the behavior to loop over the returned items in the query? In my “Podcast Link” template, all I can seem to echo out successfully is the name the content_item that contains the query, not the query results. I’ve seen various idioms in documentation such as …
#foreach($relresult in $sys.currentslot.relresults) … but this isn’t working for me. $relresult seems to be empty or null when I do this in the “Podcast Link” template.

I apologize for this long question, and I hope it makes sense to someone. I feel like I’m pretty close, but I don’t have everything connected in just the right way. Any help would be vastly appreciated.


Which page and manual are you referencing to set up an auto index / auto slot?

In order to use an auto index you must have a slot with the “sys_AutoSlotContentFinder” content finder selected.

This slot is then called as:

#slot("slotName" "" "" "" "" "query=queryString&template=templateName&max_results=5")##


#initslot("slotName" "query=queryString&template=templateName&max_results=5")##
#if($sys.currentslot.relresults.size() > 0)##
#foreach($relresult in $sys.currentslot.relresults)##
You can reference the current item through $relresult.getNode().getProperty("...").String

It can be tricky so let me know what you’re referencing in the manual/documentation and I’ll try my best to explain.

Thanks for your reply. I’m using the Implementation Guide .pdf for version 6.7, starting at around pg. 132. I see now that the sys_AutoSlotContentFinder relationship type is specified there, and in this case, I can pass my query directly into the #slot() reference.

While scanning the forums, I found an example PDF posted by a different user that I was using to attempt to set up the keyword auto-index query. Essentially, I’m going to require a number of different queries … so I though I would set up the keywords query so that I could choose the query I needed in a content_item, then insert that item into the overall page using Active Assembly – the goal her would be to allow for all the query selection to take place in the CMS … to avoid having to hard-code items into Workbench templates for each different page path.

Do the steps I outline above seem to make sense, given that goal? It does appear that changing the relationship finder, as you suggested, allows me to see my results now, but only if I hard-code the query into the template.

We have a Generic Autoindexer that has a text field for the “folder path to index”. A user then inputs the folder path to index and the auto indexer indexes the content in that path. We then build the query on the fly during the various contexts (ie. preview, publish).

So just to recap, we have one slot, but depending on the variables we pass it, it creates the necessary queries on the fly. We are initializing the slot ourselves, but technically, you could pass in the parameters to the slot macro.

Oh, to pass in the parameters, creating a map should do the trick:

Thank you, as well, for posting this. I think I understand what you’re doing, and the Mapping option is one I wasn’t aware of … so I will play with that.

Here is one other nut that I’m trying to crack relating to this: what if I have multiple sub-queries that I want to run on one page? For example, I want to run a query on Podcast Type A, and display them in a certain way; then, I want to get all other Podcasts, and display them in a simple UL … that sort of idea.

Perhaps I could use the Mapping idea in this circumstance … then do a loop in the template, calling the slot on each query. Does that sound like a reasonable approach?

Multiple sub queries should be doable… you would just be calling the same slot but passing it different parameter maps and formatting options…

I had to put this down for a few days, but I’m finally able to use the auto slot to run queries and pull in my podcasts. Thanks for the help.

I have a follow-up question that I thought I would also throw out there, as I don’t see much when searching the forums.

In my podcast content_type, I have two binary fields for the MP3 attachment and a PDF transcript. This allows the content editors to simply create one entry in the system with all the requisite information about that podcast, including the MP3 file itself. But I cannot figure out where those files are being uploaded so that I can link to them in the template.

I’ve tried things like binding a variable to “$rx.location.generate($sys.item.getProperty(‘rx:mp3’))”, though I know that exact syntax won’t work.

Then I found some information on Location Schemes, and that seems to be more what I need. But I’m still not sure how that will work. If I define a location scheme for a Podcast snippet, how do I refer to that in the snippet template itself?


Do you have a binary template for the MP3 and PDF fields? You can reference this binary template through


Hi Riley …

With that code snippet, how do I specify the field itself? In this case, I have two attachment fields that I want to link to in the snippet template (the MP3, and the Transcript PDF). Isn’t $sys.assemblyItem just the entire content_item object? I tried to use “$sys.assemblyItem.getProperty(‘mp3’)” … but it doesn’t like that.

Thanks for your consideration.



You will need to create a binary template for each sys_File field in order to publish the file and to provide a link to the item. Upon creating the binary template you will need to specify the following bindings:

Variable Name: $sys.binary
Value (JEXL expression): $sys.item.getProperty("rx:mp3")

You will need to specify the attachment’s mime type.

Variable Name: $sys.mimetype
Value (JEXL expression): $sys.item.getProperty("rx:mp3_mimetype")

You are right that $sys.assemblyItem references the entire content item. By using $rx.location.generate and changing the templateName the link generated will go to the designated file type.

Thanks again, Riley. I did see reference to this in the Implementation Guide, but it didn’t quite make sense until you described it. I’ll give this a try and see if I can get it to work.