cancel
Showing results for 
Search instead for 
Did you mean: 

row.parent.properties.title reference in Custom Search error

shikarishambu
Champ in-the-making
Champ in-the-making
I have a custom webscript that references row.parent.properties.title in the Freemarker template to get the name of the folder associated with the file. In some cases this results in an error (i.e. some results are returned, then there is a freemarker exception that results in error XML being stuffed into the search results and breaking it). Any ideas/ suggestions on how to avoid this error/ get the folder associated with the document being returned by the search

Here is the freemarker template

<?xml version="1.0" encoding="UTF-8"?>
<search>
<#list results as row>           
  <item>
   <title>${row.name}</title>
      <link>${absurl(url.context)}${row.url}</link>
   <folderpath>${row.displayPath}</folderpath>
   <folder>${row.parent.properties.title}</folder>
    <description>${row.properties.description!""}</description>
    <pubDate>${xmldate(row.properties.modified)}</pubDate>
  </item>
</#list>
</search>

1 REPLY 1

mikeh
Star Contributor
Star Contributor
Title is optional, so copy the pattern for the description property:

   <folder>${row.parent.properties.title!""}</folder>
Thanks,
Mike