AnsweredAssumed Answered

Custom search webscript returning invalid node references

Question asked by shikarishambu on Apr 12, 2010
Latest reply on Apr 13, 2010 by shikarishambu
I have a custom search webscript that uses lucene search query. It looks like it is returning invalid node references along with valid nodes causing the freemarker template that shows the return as xml to fail. Has anyone encountered such error. Why is the lucene search returning invalid node references. The error I get is

03120118 Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'

Here is the sample returned and the associated ftl template

<?xml version="1.0" encoding="ISO-8859-1"?>
<search>
  <item>
   <title>Anti Fraud Requirements.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/d07183d0-510a-4f69-824f-982b58ca51d7/Anti%20Fraud%20Requirements.pdf</link>
      <folderpath>/Company Home/Library</folderpath>
      <folder></folder>
    <description>Image</description>
    <pubDate>2010-03-05T16:15:34.718-06:00</pubDate>
       <docid></docid>
       <category>Library</category>
       <subcategory></subcategory>
       <policyno></policyno>
       <claimno></claimno>
       <agentno></agentno>
       <govtid></govtid>
       <contractno></contractno>
       <product></product>
       <region></region>
       <keywords>Library</keywords>
       <comments></comments>
      <categories></categories>
    <guid isPermaLink="false">d07183d0-510a-4f69-824f-982b58ca51d7</guid>
  </item>
  <item>
   <title>100000_SOB.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/c13c6641-387c-4f2a-aecf-e972dc2d9e35/100000_SOB.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-09T13:34:36.796-06:00</pubDate>
       <docid></docid>
       <category></category>
       <subcategory></subcategory>
       <policyno>100000</policyno>
       <claimno></claimno>
       <agentno></agentno>
       <govtid></govtid>
       <contractno></contractno>
       <product></product>
       <region></region>
       <keywords></keywords>
       <comments></comments>
      <categories></categories>
    <guid isPermaLink="false">c13c6641-387c-4f2a-aecf-e972dc2d9e35</guid>
  </item>
  <item>
   <title>100031.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/7f681ed9-027f-45b7-93a0-78695605455d/100031.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-09T13:35:55.578-06:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">7f681ed9-027f-45b7-93a0-78695605455d</guid>
  </item>
  <item>
   <title>100031_OVLY.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/2420ddc5-893d-4ad0-8232-89ac718045c3/100031_OVLY.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-09T13:35:56.406-06:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">2420ddc5-893d-4ad0-8232-89ac718045c3</guid>
  </item>
  <item>
   <title>100000.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/c7ed1fc7-508e-4395-bd3e-ac8dd162b4bc/100000.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-10T10:11:29.312-06:00</pubDate>
       <docid></docid>
       <category></category>
       <subcategory></subcategory>
       <policyno>100000</policyno>
       <claimno></claimno>
       <agentno></agentno>
       <govtid></govtid>
       <contractno></contractno>
       <product></product>
       <region></region>
       <keywords></keywords>
       <comments></comments>
      <categories></categories>
    <guid isPermaLink="false">c7ed1fc7-508e-4395-bd3e-ac8dd162b4bc</guid>
  </item>
  <item>
   <title>100000_OVLY.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/da74cd36-dc64-475a-af78-6152d2629669/100000_OVLY.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-10T10:12:16.937-06:00</pubDate>
       <docid></docid>
       <category></category>
       <subcategory></subcategory>
       <policyno>100000</policyno>
       <claimno></claimno>
       <agentno></agentno>
       <govtid></govtid>
       <contractno></contractno>
       <product></product>
       <region></region>
       <keywords></keywords>
       <comments></comments>
      <categories></categories>
    <guid isPermaLink="false">da74cd36-dc64-475a-af78-6152d2629669</guid>
  </item>
  <item>
   <title>132855_SOB.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/9aed00fa-a582-4308-a9a7-ca5045f63a85/132855_SOB.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-19T08:31:53.859-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">9aed00fa-a582-4308-a9a7-ca5045f63a85</guid>
  </item>
  <item>
   <title>132855.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/8c1e9f88-f965-43e4-9ebd-45311596f98c/132855.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-19T08:31:55.656-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">8c1e9f88-f965-43e4-9ebd-45311596f98c</guid>
  </item>
  <item>
   <title>132855_OVLY.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/6d917095-000c-4c06-8324-419dc963e2e7/132855_OVLY.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-19T08:31:56.296-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">6d917095-000c-4c06-8324-419dc963e2e7</guid>
  </item>
  <item>
   <title>131615_SOB.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/e8cc7376-d602-4b41-9874-f317ef1f9d82/131615_SOB.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-19T08:32:34.125-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">e8cc7376-d602-4b41-9874-f317ef1f9d82</guid>
  </item>
  <item>
   <title>131615.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/9d803ca4-6218-4eb4-9f53-ea0321300865/131615.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-19T08:32:35.531-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">9d803ca4-6218-4eb4-9f53-ea0321300865</guid>
  </item>
  <item>
   <title>131615_OVLY.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/08eb30ee-0ea4-4750-9659-37c0596d60b1/131615_OVLY.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description>Policy Pages</description>
    <pubDate>2010-03-19T08:32:36.281-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">08eb30ee-0ea4-4750-9659-37c0596d60b1</guid>
  </item>
  <item>
   <title>133459_SOB.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/41c1903f-440f-47bd-8f87-d5e5bb34af8a/133459_SOB.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-19T15:11:43.062-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">41c1903f-440f-47bd-8f87-d5e5bb34af8a</guid>
  </item>
  <item>
   <title>133459.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/2d32e165-0e96-4357-8380-8ede812dee21/133459.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-19T15:12:01.140-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">2d32e165-0e96-4357-8380-8ede812dee21</guid>
  </item>
  <item>
   <title>133459_OVLY.pdf</title>
      <link>http://Stastepecm01a:8080/alfresco/d/d/workspace/SpacesStore/47039992-0a19-49c2-8359-e6fd69f6e018/133459_OVLY.pdf</link>
      <folderpath>/Company Home/1/DOF/PolicyStatus</folderpath>
      <folder>Policy Status</folder>
    <description></description>
    <pubDate>2010-03-19T15:12:04.843-05:00</pubDate>
      <categories></categories>
    <guid isPermaLink="false">47039992-0a19-49c2-8359-e6fd69f6e018</guid>
  </item>
  <item>
   <title><?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>
    500
    <name>Internal Error</name>
    <description>An error inside the HTTP server which prevented it from fulfilling the request.</description>
  </status>
  <message>03120119 Wrapped Exception (with status template): 03120118 Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.</message>
  <exception>org.alfresco.web.scripts.WebScriptException - 03120119 Wrapped Exception (with status template): 03120118 Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.</exception>
  <callstack>
      org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/9b261131-e7b1-417f-8bb7-925d8941e555
         org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:158)
         org.alfresco.repo.node.db.DbNodeServiceImpl.hasAspect(DbNodeServiceImpl.java:719)
         sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
         org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         $Proxy9.hasAspect(Unknown Source)
         sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         $Proxy9.hasAspect(Unknown Source)
         sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
         $Proxy10.hasAspect(Unknown Source)
         org.alfresco.repo.node.MLPropertyInterceptor.getPivotNodeRef(MLPropertyInterceptor.java:324)
         org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:174)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:217)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:217)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         $Proxy9.getProperties(Unknown Source)
         sun.reflect.GeneratedMethodAccessor277.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
         org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:275)
         org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
         org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         $Proxy9.getProperties(Unknown Source)
         org.alfresco.repo.template.TemplateNode.getProperties(TemplateNode.java:227)
         org.alfresco.repo.template.TemplateNode.getName(TemplateNode.java:196)
         sun.reflect.GeneratedMethodAccessor598.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:835)
         freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:276)
         freemarker.ext.beans.BeanModel.get(BeanModel.java:183)
         freemarker.core.Dot._getAsTemplateModel(Dot.java:76)
         freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
         freemarker.core.Expression.getStringValue(Expression.java:93)
         freemarker.core.DollarVariable.accept(DollarVariable.java:76)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.MixedContent.accept(MixedContent.java:92)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
         freemarker.core.Environment.visit(Environment.java:415)
         freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.MixedContent.accept(MixedContent.java:92)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.Environment.process(Environment.java:188)
         freemarker.template.Template.process(Template.java:237)
         org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
         org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:523)
         org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:241)
         org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
         org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:357)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
         org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:407)
         org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:424)
         org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:288)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:262)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
         org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         java.lang.Thread.run(Thread.java:619)
      java.lang.reflect.InvocationTargetException
      sun.reflect.GeneratedMethodAccessor598.invoke(Unknown Source)
      freemarker.template.TemplateModelException: get(name) failed on instance of org.alfresco.repo.template.TemplateNode
      freemarker.ext.beans.BeanModel.get(BeanModel.java:223)
      org.alfresco.service.cmr.repository.TemplateException: 03120118 Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.
      org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)
      org.alfresco.web.scripts.WebScriptException: 03120119 Wrapped Exception (with status template): 03120118 Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.
      org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
  </callstack>
  <server>Alfresco Community v3.2.0 (2039) schema 2,019</server>
  <time>Apr 12, 2010 1:03:32 PM</time>
</response>


Freemarker template
<?xml version="1.0" encoding="ISO-8859-1"?>
<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>
   <#if row.properties["step:docid"]?? == true>
    <docid>${row.properties["step:docid"]!""}</docid>
   </#if>
   <#if row.properties["step:category"]?? == true>
    <category>${row.properties["step:category"]!""}</category>
   </#if>
   <#if row.properties["step:subcategory"]?? == true>
    <subcategory>${row.properties["step:subcategory"]!""}</subcategory>
   </#if>
   <#if row.properties["step:policyno"]?? == true>
    <policyno>${row.properties["step:policyno"]!""}</policyno>
   </#if>
   <#if row.properties["step:claimno"]?? == true>
    <claimno>${row.properties["step:claimno"]!""}</claimno>
   </#if>
   <#if row.properties["step:agentno"]?? == true>
    <agentno>${row.properties["step:agentno"]!""}</agentno>
   </#if>
   <#if row.properties["step:providerno"]?? == true>
    <providerno>${row.properties["step:providerno"]!""}</providerno>
   </#if>
   <#if row.properties["step:govtid"]?? == true>
    <govtid>${row.properties["step:govtid"]!""}</govtid>
   </#if>
   <#if row.properties["step:contractno"]?? == true>
    <contractno>${row.properties["step:contractno"]!""}</contractno>
   </#if>
   <#if row.properties["step:product"]?? == true>
    <product>${row.properties["step:product"]!""}</product>
   </#if>
   <#if row.properties["step:region"]?? == true>
    <region>${row.properties["step:region"]!""}</region>
   </#if>
   <#if row.properties["step:keywords"]?? == true>
    <keywords>${row.properties["step:keywords"]!""}</keywords>
   </#if>
   <#if row.properties["step:comments"]?? == true>
    <comments>${row.properties["step:comments"]!""}</comments>
   </#if>
   <categories><#list row.properties.categories![] as c>"${c.name?xml}"<#if c_has_next>,</#if></#list></categories>
    <guid isPermaLink="false">${row.id}</guid>
  </item>
</#list>
</search>

Outcomes